* Loads the current value of each pixel in the framebuffer into its * pixels array. * * `myBuffer.loadPixels()` must be called before reading from or writing to * myBuffer.pixels . * * @example * function
()
| 1006 | * } |
| 1007 | */ |
| 1008 | loadPixels() { |
| 1009 | this._update('colorTexture'); |
| 1010 | const result = this.renderer.readFramebufferPixels(this); |
| 1011 | |
| 1012 | // Check if renderer returned a Promise (WebGPU) or data directly (WebGL) |
| 1013 | if (result && typeof result.then === 'function') { |
| 1014 | // WebGPU async case - return Promise |
| 1015 | return result.then(pixels => { |
| 1016 | this.pixels = pixels; |
| 1017 | return pixels; |
| 1018 | }); |
| 1019 | } else { |
| 1020 | // WebGL sync case - assign directly |
| 1021 | this.pixels = result; |
| 1022 | return result; |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | /** |
| 1027 | * Gets a pixel or a region of pixels from the framebuffer. |
nothing calls this directly
no test coverage detected