Explorar o código

WebGLRenderer: Remove redundant activeTexture call. See c06ebb822d5b28ff8674226dae88c522f403c0e0.

Mr.doob %!s(int64=10) %!d(string=hai) anos
pai
achega
1c5263680d
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      src/renderers/WebGLRenderer.js

+ 4 - 4
src/renderers/WebGLRenderer.js

@@ -5479,7 +5479,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	}
 	}
 
 
-	this.uploadTexture = function ( texture ) {
+	this.uploadTexture = function ( texture, slot ) {
 
 
 		if ( texture.__webglInit === undefined ) {
 		if ( texture.__webglInit === undefined ) {
 
 
@@ -5493,6 +5493,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		_gl.activeTexture( _gl.TEXTURE0 + slot );
 		_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
 		_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
 
 
 		_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
 		_gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
@@ -5594,8 +5595,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 	this.setTexture = function ( texture, slot ) {
 	this.setTexture = function ( texture, slot ) {
 
 
-		_gl.activeTexture( _gl.TEXTURE0 + slot );
-
 		if ( texture.needsUpdate === true ) {
 		if ( texture.needsUpdate === true ) {
 
 
 			var image = texture.image;
 			var image = texture.image;
@@ -5607,11 +5606,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			}
 			}
 
 
-			_this.uploadTexture( texture );
+			_this.uploadTexture( texture, slot );
 			return;
 			return;
 
 
 		}
 		}
 
 
+		_gl.activeTexture( _gl.TEXTURE0 + slot );
 		_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
 		_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
 
 
 	};
 	};