(target)
| 299 | } |
| 300 | |
| 301 | function framebufferToTexture (target) { |
| 302 | gl.bindFramebuffer(gl.FRAMEBUFFER, target.fbo); |
| 303 | let length = target.width * target.height * 4; |
| 304 | let texture = new Float32Array(length); |
| 305 | gl.readPixels(0, 0, target.width, target.height, gl.RGBA, gl.FLOAT, texture); |
| 306 | return texture; |
| 307 | } |
| 308 | |
| 309 | function normalizeTexture (texture, width, height) { |
| 310 | let result = new Uint8Array(texture.length); |