瀏覽代碼

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 年之前
父節點
當前提交
c3415d727c
共有 1 個文件被更改,包括 17 次插入1 次删除
  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();