Procházet zdrojové kódy

Add compressed texture support to WebGLRenderer.copyTextureToTexture()

Frank Olivier před 5 roky
rodič
revize
53067cb99a
1 změnil soubory, kde provedl 9 přidání a 1 odebrání
  1. 9 1
      src/renderers/WebGLRenderer.js

+ 9 - 1
src/renderers/WebGLRenderer.js

@@ -2818,7 +2818,15 @@ function WebGLRenderer( parameters ) {
 
 
 		} else {
 		} else {
 
 
-			_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );
+			if ( srcTexture.isCompressedTexture ) {
+
+				_gl.compressedTexSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, srcTexture.mipmaps[ 0 ].width, srcTexture.mipmaps[ 0 ].height, glFormat, srcTexture.mipmaps[ 0 ].data );
+
+			} else {
+
+				_gl.texSubImage2D( _gl.TEXTURE_2D, level, position.x, position.y, glFormat, glType, srcTexture.image );
+
+			}
 
 
 		}
 		}