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: Enable subframe upload in copyTextureToTexture, align API to 3d version #956

Merged
merged 5 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
10 changes: 5 additions & 5 deletions examples-testing/changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1952,7 +1952,7 @@ index 977dbadb..fb1460ca 100644
material.uniforms['u_renderthreshold'].value = volconfig.isothreshold; // For ISO renderstyle
material.uniforms['u_cmdata'].value = cmtextures[volconfig.colormap];
diff --git a/examples-testing/examples/webgl2_materials_texture3d_partialupdate.ts b/examples-testing/examples/webgl2_materials_texture3d_partialupdate.ts
index fc2fc783..cd17b027 100644
index 1ad6d264..10b32582 100644
--- a/examples-testing/examples/webgl2_materials_texture3d_partialupdate.ts
+++ b/examples-testing/examples/webgl2_materials_texture3d_partialupdate.ts
@@ -6,14 +6,14 @@ import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
Expand Down Expand Up @@ -1987,8 +1987,8 @@ index fc2fc783..cd17b027 100644
const scaleFactor = (Math.random() + 0.5) * 0.5;
const source = generateCloudTexture(perElementPaddedSize, scaleFactor);

- renderer.copyTextureToTexture3D(box, position, source, cloudTexture);
+ renderer.copyTextureToTexture3D(box, position, source, cloudTexture!);
- renderer.copyTextureToTexture3D(source, cloudTexture, box, position);
+ renderer.copyTextureToTexture3D(source, cloudTexture!, box, position);

prevTime = time;

Expand Down Expand Up @@ -5901,7 +5901,7 @@ index adfcfddf..d26cee37 100644
INTERSECTED = null;
}
diff --git a/examples-testing/examples/webgl_interactive_cubes_gpu.ts b/examples-testing/examples/webgl_interactive_cubes_gpu.ts
index 313b023a..7e77fbc5 100644
index 2644469c..d48fa232 100644
--- a/examples-testing/examples/webgl_interactive_cubes_gpu.ts
+++ b/examples-testing/examples/webgl_interactive_cubes_gpu.ts
@@ -5,12 +5,12 @@ import Stats from 'three/addons/libs/stats.module.js';
Expand Down Expand Up @@ -9104,7 +9104,7 @@ index 24bd4eb9..5d5e77b6 100644
mouseY = event.clientY - windowHalfY;
}
diff --git a/examples-testing/examples/webgl_materials_texture_partialupdate.ts b/examples-testing/examples/webgl_materials_texture_partialupdate.ts
index 04844817..2f734b77 100644
index 5adfc8e6..55d802e3 100644
--- a/examples-testing/examples/webgl_materials_texture_partialupdate.ts
+++ b/examples-testing/examples/webgl_materials_texture_partialupdate.ts
@@ -1,6 +1,11 @@
Expand Down
27 changes: 19 additions & 8 deletions types/three/src/renderers/WebGLRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TypedArray } from "../core/BufferAttribute.js";
import { BufferGeometry } from "../core/BufferGeometry.js";
import { Object3D } from "../core/Object3D.js";
import { Material } from "../materials/Material.js";
import { Box2 } from "../math/Box2.js";
import { Box3 } from "../math/Box3.js";
import { Color, ColorRepresentation } from "../math/Color.js";
import { Plane } from "../math/Plane.js";
Expand Down Expand Up @@ -447,28 +448,38 @@ export class WebGLRenderer implements Renderer {
copyFramebufferToTexture(position: Vector2, texture: Texture, level?: number): void;

/**
* Copies srcTexture to the specified level of dstTexture, offset by the input position.
* Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
* position.
*
* @param position Specifies the pixel offset into the dstTexture where the copy will occur.
* @param srcTexture Specifies the source texture.
* @param dstTexture Specifies the destination texture.
* @param srcRegion Specifies the bounds
* @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
* @param level Specifies the destination mipmap level of the texture.
*/
copyTextureToTexture(position: Vector2, srcTexture: Texture, dstTexture: Texture, level?: number): void;
copyTextureToTexture(
srcTexture: Texture,
dstTexture: Texture,
srcRegion?: Box2 | null,
dstPosition?: Vector2 | null,
level?: number,
): void;

/**
* Copies the pixels of a texture in the bounds sourceBox in the desination texture starting from the given position.
* @param sourceBox Specifies the bounds
* @param position Specifies the pixel offset into the dstTexture where the copy will occur.
* Copies the pixels of a texture in the bounds `srcRegion` in the destination texture starting from the given
* position.
*
* @param srcTexture Specifies the source texture.
* @param dstTexture Specifies the destination texture.
* @param srcRegion Specifies the bounds
* @param dstPosition Specifies the pixel offset into the dstTexture where the copy will occur.
* @param level Specifies the destination mipmap level of the texture.
*/
copyTextureToTexture3D(
sourceBox: Box3,
position: Vector3,
srcTexture: Texture,
dstTexture: Data3DTexture | DataArrayTexture,
srcRegion?: Box3 | null,
dstPosition?: Vector3 | null,
level?: number,
): void;

Expand Down
Loading