Browse Source

WebGLRenderer: Fixed compressed partial update on texture3D (#27771)

* Fixed compressed partial update on texture3D and add example to e2e tests

* removed example
Renaud Rohlinger 1 year ago
parent
commit
cfdd878cf7
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/renderers/WebGLRenderer.js

+ 3 - 4
src/renderers/WebGLRenderer.js

@@ -2440,8 +2440,8 @@ class WebGLRenderer {
 
 
 			}
 			}
 
 
-			const width = sourceBox.max.x - sourceBox.min.x + 1;
-			const height = sourceBox.max.y - sourceBox.min.y + 1;
+			const width = Math.round( sourceBox.max.x - sourceBox.min.x );
+			const height = Math.round( sourceBox.max.y - sourceBox.min.y );
 			const depth = sourceBox.max.z - sourceBox.min.z + 1;
 			const depth = sourceBox.max.z - sourceBox.min.z + 1;
 			const glFormat = utils.convert( dstTexture.format );
 			const glFormat = utils.convert( dstTexture.format );
 			const glType = utils.convert( dstTexture.type );
 			const glType = utils.convert( dstTexture.type );
@@ -2488,9 +2488,8 @@ class WebGLRenderer {
 
 
 			} else {
 			} else {
 
 
-				if ( srcTexture.isCompressedArrayTexture ) {
+				if ( dstTexture.isCompressedArrayTexture ) {
 
 
-					console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
 					_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
 					_gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
 
 
 				} else {
 				} else {