| 84 | sprite.scale.set(r * 0.32, r * 0.32, 1); |
| 85 | group.add(sprite); |
| 86 | }; |
| 87 | |
| 88 | addAxis(new THREE.Vector3(1, 0, 0), 0xff3333, 'X'); |
| 89 | addAxis(new THREE.Vector3(0, 1, 0), 0x33dd55, 'Y'); |
| 90 | addAxis(new THREE.Vector3(0, 0, 1), 0x4488ff, 'Z'); |
| 91 | |
| 92 | return group; |
| 93 | } |
| 94 | |
| 95 | // Create a canvas-texture sprite label for a dimension annotation. |
| 96 | // Flat ground-plane label — no billboard, no background, lies directly on the bed. |
| 97 | function buildDimensionLabel(text, hex, worldW, worldH) { |
| 98 | const c = document.createElement('canvas'); |
| 99 | c.width = 256; |
| 100 | c.height = 64; |
| 101 | const ctx = c.getContext('2d'); |
| 102 | ctx.clearRect(0, 0, 256, 64); |
| 103 | ctx.fillStyle = `#${hex.toString(16).padStart(6, '0')}`; |
| 104 | ctx.font = 'bold 36px Arial'; |
| 105 | ctx.textAlign = 'center'; |
| 106 | ctx.textBaseline = 'middle'; |
| 107 | ctx.fillText(text, 128, 32); |
| 108 | // depthWrite OFF + renderOrder above the wireframe overlay (3) — same |
| 109 | // reasoning as the axis label sprites: a depth-writing transparent quad |