|
@@ -25589,7 +25589,9 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- const { width, height, data } = srcTexture.image;
|
|
|
+ const width = sourceBox.max.x - sourceBox.min.x + 1;
|
|
|
+ const height = sourceBox.max.y - sourceBox.min.y + 1;
|
|
|
+ const depth = sourceBox.max.z - sourceBox.min.z + 1;
|
|
|
const glFormat = utils.convert( dstTexture.format );
|
|
|
const glType = utils.convert( dstTexture.type );
|
|
|
let glTarget;
|
|
@@ -25621,25 +25623,32 @@ function WebGLRenderer( parameters = {} ) {
|
|
|
const unpackSkipRows = _gl.getParameter( 3315 );
|
|
|
const unpackSkipImages = _gl.getParameter( 32877 );
|
|
|
|
|
|
- _gl.pixelStorei( 3314, width );
|
|
|
- _gl.pixelStorei( 32878, height );
|
|
|
+ const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;
|
|
|
+
|
|
|
+ _gl.pixelStorei( 3314, image.width );
|
|
|
+ _gl.pixelStorei( 32878, image.height );
|
|
|
_gl.pixelStorei( 3316, sourceBox.min.x );
|
|
|
_gl.pixelStorei( 3315, sourceBox.min.y );
|
|
|
_gl.pixelStorei( 32877, sourceBox.min.z );
|
|
|
|
|
|
- _gl.texSubImage3D(
|
|
|
- glTarget,
|
|
|
- level,
|
|
|
- position.x,
|
|
|
- position.y,
|
|
|
- position.z,
|
|
|
- sourceBox.max.x - sourceBox.min.x + 1,
|
|
|
- sourceBox.max.y - sourceBox.min.y + 1,
|
|
|
- sourceBox.max.z - sourceBox.min.z + 1,
|
|
|
- glFormat,
|
|
|
- glType,
|
|
|
- data
|
|
|
- );
|
|
|
+ if ( srcTexture.isDataTexture || srcTexture.isDataTexture3D ) {
|
|
|
+
|
|
|
+ _gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if ( srcTexture.isCompressedTexture ) {
|
|
|
+
|
|
|
+ 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 );
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ _gl.texSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
_gl.pixelStorei( 3314, unpackRowLen );
|
|
|
_gl.pixelStorei( 32878, unpackImageHeight );
|