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 #28281

Merged
merged 17 commits into from
May 7, 2024
Prev Previous commit
Next Next commit
Simplify
  • Loading branch information
gkjohnson committed May 6, 2024
commit 7398afd322a3da34714e6ba0df86b6456a301acc
8 changes: 3 additions & 5 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2375,7 +2375,7 @@ class WebGLRenderer {
this.copyTextureToTexture = function ( position, srcTexture, dstTexture, level = 0, sourceBox = null ) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think srcRegion is more clear and follows the rest of the parameter names.


let width, height, minX, minY;
if ( sourceBox ) {
if ( sourceBox !== null ) {

width = sourceBox.max.x - sourceBox.min.x;
height = sourceBox.max.y - sourceBox.min.y;
Expand Down Expand Up @@ -2462,7 +2462,8 @@ class WebGLRenderer {
}

let width, height, depth, minX, minY, minZ;
if ( sourceBox ) {
const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
if ( sourceBox !== null ) {

width = sourceBox.max.x - sourceBox.min.x;
height = sourceBox.max.y - sourceBox.min.y;
Expand All @@ -2473,7 +2474,6 @@ class WebGLRenderer {

} else {

const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
width = image.width;
height = image.height;
depth = image.depth;
Expand Down Expand Up @@ -2514,8 +2514,6 @@ class WebGLRenderer {
const currentUnpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
const currentUnpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );

const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;

_gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
_gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
_gl.pixelStorei( _gl.UNPACK_SKIP_PIXELS, minX );
Expand Down