Răsfoiți Sursa

Add compressed texture support to WebGLRenderer.copyTextureToTexture()

Frank Olivier 5 ani în urmă
părinte
comite
53067cb99a
1 a modificat fișierele cu 9 adăugiri și 1 ștergeri
  1. 9 1
      src/renderers/WebGLRenderer.js

+ 9 - 1
src/renderers/WebGLRenderer.js

@@ -2818,7 +2818,15 @@ function WebGLRenderer( parameters ) {
 
 		} 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 );
+
+			}
 
 		}