()
| 179 | } |
| 180 | |
| 181 | const setSize = () => { |
| 182 | const rect = container.getBoundingClientRect(); |
| 183 | const width = Math.max(1, Math.floor(rect.width)); |
| 184 | const height = Math.max(1, Math.floor(rect.height)); |
| 185 | renderer.setSize(width, height); |
| 186 | const res = program.uniforms.iResolution.value as Float32Array; |
| 187 | res[0] = gl.drawingBufferWidth; |
| 188 | res[1] = gl.drawingBufferHeight; |
| 189 | }; |
| 190 | |
| 191 | const ro = new ResizeObserver(setSize); |
| 192 | ro.observe(container); |