Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGLRenderer: Add "readRenderTargetPixelsAsync" function #955

Merged
merged 4 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion three.js
Submodule three.js updated 58 files
+11 −1 .github/workflows/ci.yml
+120 −6 build/three.cjs
+120 −6 build/three.module.js
+1 −1 build/three.module.min.js
+5 −1 docs/api/en/animation/tracks/BooleanKeyframeTrack.html
+1 −1 docs/api/en/animation/tracks/ColorKeyframeTrack.html
+1 −1 docs/api/en/animation/tracks/NumberKeyframeTrack.html
+5 −5 docs/api/en/animation/tracks/QuaternionKeyframeTrack.html
+6 −5 docs/api/en/animation/tracks/StringKeyframeTrack.html
+1 −1 docs/api/en/animation/tracks/VectorKeyframeTrack.html
+11 −4 docs/api/en/renderers/WebGLRenderer.html
+21 −0 docs/api/en/textures/CompressedArrayTexture.html
+22 −0 docs/api/en/textures/DataArrayTexture.html
+1 −0 editor/css/main.css
+1 −1 editor/index.html
+1 −1 editor/js/Sidebar.Material.js
+24 −10 editor/js/Sidebar.Scene.js
+94 −2 editor/js/Strings.js
+18 −1 editor/js/Viewport.Controls.js
+1 −1 editor/js/commands/AddObjectCommand.js
+1 −1 editor/js/commands/AddScriptCommand.js
+1 −1 editor/js/commands/MoveObjectCommand.js
+1 −1 editor/js/commands/MultiCmdsCommand.js
+1 −1 editor/js/commands/RemoveObjectCommand.js
+1 −1 editor/js/commands/RemoveScriptCommand.js
+1 −1 editor/js/commands/SetColorCommand.js
+1 −1 editor/js/commands/SetGeometryCommand.js
+1 −1 editor/js/commands/SetGeometryValueCommand.js
+1 −1 editor/js/commands/SetMaterialColorCommand.js
+1 −1 editor/js/commands/SetMaterialCommand.js
+1 −1 editor/js/commands/SetMaterialMapCommand.js
+1 −1 editor/js/commands/SetMaterialRangeCommand.js
+1 −1 editor/js/commands/SetMaterialValueCommand.js
+2 −2 editor/js/commands/SetMaterialVectorCommand.js
+1 −1 editor/js/commands/SetPositionCommand.js
+1 −1 editor/js/commands/SetRotationCommand.js
+1 −1 editor/js/commands/SetScaleCommand.js
+1 −1 editor/js/commands/SetSceneCommand.js
+1 −1 editor/js/commands/SetScriptValueCommand.js
+1 −1 editor/js/commands/SetUuidCommand.js
+1 −1 editor/js/commands/SetValueCommand.js
+2 −0 editor/js/libs/ui.js
+10 −10 editor/js/libs/ui.three.js
+4 −4 examples/jsm/renderers/common/ClippingContext.js
+16 −12 examples/webgl_interactive_cubes_gpu.html
+1 −1 examples/webgl_renderer_pathtracer.html
+67 −67 package-lock.json
+10 −1 src/animation/tracks/BooleanKeyframeTrack.js
+1 −2 src/animation/tracks/QuaternionKeyframeTrack.js
+10 −1 src/animation/tracks/StringKeyframeTrack.js
+3 −1 src/loaders/LoaderUtils.js
+80 −1 src/renderers/WebGLRenderer.js
+82 −2 src/renderers/webgl/WebGLTextures.js
+14 −0 src/textures/CompressedArrayTexture.js
+14 −0 src/textures/DataArrayTexture.js
+30 −1 src/utils.js
+0 −5 test/unit/src/animation/tracks/BooleanKeyframeTrack.tests.js
+0 −5 test/unit/src/animation/tracks/StringKeyframeTrack.tests.js
13 changes: 12 additions & 1 deletion types/three/src/renderers/WebGLRenderer.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Camera } from "../cameras/Camera.js";
import { ColorSpace, CullFace, ShadowMapType, ToneMapping, WebGLCoordinateSystem } from "../constants.js";
import { TypedArray } from "../core/BufferAttribute.js";
import { BufferGeometry } from "../core/BufferGeometry.js";
import { Object3D } from "../core/Object3D.js";
import { Material } from "../materials/Material.js";
Expand Down Expand Up @@ -421,10 +422,20 @@ export class WebGLRenderer implements Renderer {
y: number,
width: number,
height: number,
buffer: any,
buffer: TypedArray,
activeCubeFaceIndex?: number,
): void;

readRenderTargetPixelsAsync(
renderTarget: WebGLRenderTarget | WebGLRenderTarget<Texture[]>,
x: number,
y: number,
width: number,
height: number,
buffer: TypedArray,
activeCubeFaceIndex?: number,
): Promise<TypedArray>;

/**
* Copies a region of the currently bound framebuffer into the selected mipmap level of the selected texture.
* This region is defined by the size of the destination texture's mip level, offset by the input position.
Expand Down
2 changes: 2 additions & 0 deletions types/three/src/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export function createCanvasElement(): HTMLCanvasElement;

export function probeAsync(gl: WebGLRenderingContext, sync: WebGLSync, interval: number): Promise<void>;
Loading