(type: NodeType)
| 88 | |
| 89 | /** Canvas texture for 3D sphere materials */ |
| 90 | export function getPatternTexture(type: NodeType): THREE.CanvasTexture { |
| 91 | if (textureCache.has(type)) return textureCache.get(type)!; |
| 92 | |
| 93 | const canvas = document.createElement('canvas'); |
| 94 | canvas.width = SIZE; |
| 95 | canvas.height = SIZE; |
| 96 | drawPattern(canvas.getContext('2d')!, type); |
| 97 | |
| 98 | const texture = new THREE.CanvasTexture(canvas); |
| 99 | texture.wrapS = THREE.RepeatWrapping; |
| 100 | texture.wrapT = THREE.RepeatWrapping; |
| 101 | textureCache.set(type, texture); |
| 102 | return texture; |
| 103 | } |
| 104 | |
| 105 | /** CSS inline styles for 2D HTML swatches (legend, context menu) */ |
| 106 | export const PATTERN_CSS: Record<NodeType, CSSProperties> = { |
no test coverage detected