(hex: string)
| 13 | } |
| 14 | |
| 15 | const hexToRgb = (hex: string): [number, number, number] => { |
| 16 | const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); |
| 17 | if (!result) return [1, 0.5, 0.2]; |
| 18 | return [ |
| 19 | parseInt(result[1], 16) / 255, |
| 20 | parseInt(result[2], 16) / 255, |
| 21 | parseInt(result[3], 16) / 255, |
| 22 | ]; |
| 23 | }; |
| 24 | |
| 25 | const vertex = `#version 300 es |
| 26 | precision highp float; |