Browse Source

WebGLRenderer: call setTextureCube and setTexture3D on initTexture (#24245)

* WebGLRenderer: call setTextureCube and setTexture3D on initTexture

* Update WebGLRenderer.js

Clean up.

Co-authored-by: Michael Herzog <[email protected]>
Nuño de la Serna 3 years ago
parent
commit
c3415d727c
1 changed files with 17 additions and 1 deletions
  1. 17 1
      src/renderers/WebGLRenderer.js

+ 17 - 1
src/renderers/WebGLRenderer.js

@@ -2176,7 +2176,23 @@ function WebGLRenderer( parameters = {} ) {
 
 	this.initTexture = function ( texture ) {
 
-		textures.setTexture2D( texture, 0 );
+		if ( texture.isCubeTexture ) {
+
+			textures.setTextureCube( texture, 0 );
+
+		} else if ( texture.isData3DTexture ) {
+
+			textures.setTexture3D( texture, 0 );
+
+		} else if ( texture.isDataArrayTexture ) {
+
+			textures.setTexture2DArray( texture, 0 );
+
+		} else {
+
+			textures.setTexture2D( texture, 0 );
+
+		}
 
 		state.unbindTexture();