浏览代码

Updated builds.

Mr.doob 2 年之前
父节点
当前提交
ed076f90f0
共有 4 个文件被更改,包括 78 次插入51 次删除
  1. 24 17
      build/three.cjs
  2. 24 17
      build/three.js
  3. 0 0
      build/three.min.js
  4. 30 17
      build/three.module.js

+ 24 - 17
build/three.cjs

@@ -16244,22 +16244,31 @@ function WebGLState(gl, extensions, capabilities) {
 		}
 	}
 
-	function bindTexture(webglType, webglTexture) {
-		if (currentTextureSlot === null) {
-			activeTexture();
+	function bindTexture(webglType, webglTexture, webglSlot) {
+		if (webglSlot === undefined) {
+			if (currentTextureSlot === null) {
+				webglSlot = gl.TEXTURE0 + maxTextures - 1;
+			} else {
+				webglSlot = currentTextureSlot;
+			}
 		}
 
-		let boundTexture = currentBoundTextures[currentTextureSlot];
+		let boundTexture = currentBoundTextures[webglSlot];
 
 		if (boundTexture === undefined) {
 			boundTexture = {
 				type: undefined,
 				texture: undefined
 			};
-			currentBoundTextures[currentTextureSlot] = boundTexture;
+			currentBoundTextures[webglSlot] = boundTexture;
 		}
 
 		if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
+			if (currentTextureSlot !== webglSlot) {
+				gl.activeTexture(webglSlot);
+				currentTextureSlot = webglSlot;
+			}
+
 			gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
 			boundTexture.type = webglType;
 			boundTexture.texture = webglTexture;
@@ -16794,8 +16803,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 			}
 		}
 
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
+		state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 	}
 
 	function setTexture2DArray(texture, slot) {
@@ -16806,8 +16814,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 			return;
 		}
 
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
+		state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 	}
 
 	function setTexture3D(texture, slot) {
@@ -16818,8 +16825,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 			return;
 		}
 
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
+		state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 	}
 
 	function setTextureCube(texture, slot) {
@@ -16830,8 +16836,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 			return;
 		}
 
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+		state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 	}
 
 	const wrappingToGL = {
@@ -16960,11 +16965,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 		if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
 		const forceUpload = initTexture(textureProperties, texture);
 		const source = texture.source;
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(textureType, textureProperties.__webglTexture);
+		state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		const sourceProperties = properties.get(source);
 
 		if (source.version !== sourceProperties.__version || forceUpload === true) {
+			state.activeTexture(_gl.TEXTURE0 + slot);
+
 			_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
 
 			_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
@@ -17182,11 +17188,12 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 		if (texture.image.length !== 6) return;
 		const forceUpload = initTexture(textureProperties, texture);
 		const source = texture.source;
-		state.activeTexture(_gl.TEXTURE0 + slot);
-		state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+		state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		const sourceProperties = properties.get(source);
 
 		if (source.version !== sourceProperties.__version || forceUpload === true) {
+			state.activeTexture(_gl.TEXTURE0 + slot);
+
 			_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
 
 			_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);

+ 24 - 17
build/three.js

@@ -16246,22 +16246,31 @@
 			}
 		}
 
-		function bindTexture(webglType, webglTexture) {
-			if (currentTextureSlot === null) {
-				activeTexture();
+		function bindTexture(webglType, webglTexture, webglSlot) {
+			if (webglSlot === undefined) {
+				if (currentTextureSlot === null) {
+					webglSlot = gl.TEXTURE0 + maxTextures - 1;
+				} else {
+					webglSlot = currentTextureSlot;
+				}
 			}
 
-			let boundTexture = currentBoundTextures[currentTextureSlot];
+			let boundTexture = currentBoundTextures[webglSlot];
 
 			if (boundTexture === undefined) {
 				boundTexture = {
 					type: undefined,
 					texture: undefined
 				};
-				currentBoundTextures[currentTextureSlot] = boundTexture;
+				currentBoundTextures[webglSlot] = boundTexture;
 			}
 
 			if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
+				if (currentTextureSlot !== webglSlot) {
+					gl.activeTexture(webglSlot);
+					currentTextureSlot = webglSlot;
+				}
+
 				gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
 				boundTexture.type = webglType;
 				boundTexture.texture = webglTexture;
@@ -16796,8 +16805,7 @@
 				}
 			}
 
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
+			state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		}
 
 		function setTexture2DArray(texture, slot) {
@@ -16808,8 +16816,7 @@
 				return;
 			}
 
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
+			state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		}
 
 		function setTexture3D(texture, slot) {
@@ -16820,8 +16827,7 @@
 				return;
 			}
 
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
+			state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		}
 
 		function setTextureCube(texture, slot) {
@@ -16832,8 +16838,7 @@
 				return;
 			}
 
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+			state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 		}
 
 		const wrappingToGL = {
@@ -16962,11 +16967,12 @@
 			if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
 			const forceUpload = initTexture(textureProperties, texture);
 			const source = texture.source;
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(textureType, textureProperties.__webglTexture);
+			state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 			const sourceProperties = properties.get(source);
 
 			if (source.version !== sourceProperties.__version || forceUpload === true) {
+				state.activeTexture(_gl.TEXTURE0 + slot);
+
 				_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
 
 				_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
@@ -17184,11 +17190,12 @@
 			if (texture.image.length !== 6) return;
 			const forceUpload = initTexture(textureProperties, texture);
 			const source = texture.source;
-			state.activeTexture(_gl.TEXTURE0 + slot);
-			state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
+			state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
 			const sourceProperties = properties.get(source);
 
 			if (source.version !== sourceProperties.__version || forceUpload === true) {
+				state.activeTexture(_gl.TEXTURE0 + slot);
+
 				_gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
 
 				_gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);

文件差异内容过多而无法显示
+ 0 - 0
build/three.min.js


+ 30 - 17
build/three.module.js

@@ -21849,25 +21849,40 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	}
 
-	function bindTexture( webglType, webglTexture ) {
+	function bindTexture( webglType, webglTexture, webglSlot ) {
 
-		if ( currentTextureSlot === null ) {
+		if ( webglSlot === undefined ) {
 
-			activeTexture();
+			if ( currentTextureSlot === null ) {
+
+				webglSlot = 33984 + maxTextures - 1;
+
+			} else {
+
+				webglSlot = currentTextureSlot;
+
+			}
 
 		}
 
-		let boundTexture = currentBoundTextures[ currentTextureSlot ];
+		let boundTexture = currentBoundTextures[ webglSlot ];
 
 		if ( boundTexture === undefined ) {
 
 			boundTexture = { type: undefined, texture: undefined };
-			currentBoundTextures[ currentTextureSlot ] = boundTexture;
+			currentBoundTextures[ webglSlot ] = boundTexture;
 
 		}
 
 		if ( boundTexture.type !== webglType || boundTexture.texture !== webglTexture ) {
 
+			if ( currentTextureSlot !== webglSlot ) {
+
+				gl.activeTexture( webglSlot );
+				currentTextureSlot = webglSlot;
+
+			}
+
 			gl.bindTexture( webglType, webglTexture || emptyTextures[ webglType ] );
 
 			boundTexture.type = webglType;
@@ -22671,8 +22686,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		}
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( 3553, textureProperties.__webglTexture );
+		state.bindTexture( 3553, textureProperties.__webglTexture, 33984 + slot );
 
 	}
 
@@ -22687,8 +22701,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		}
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( 35866, textureProperties.__webglTexture );
+		state.bindTexture( 35866, textureProperties.__webglTexture, 33984 + slot );
 
 	}
 
@@ -22703,8 +22716,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		}
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( 32879, textureProperties.__webglTexture );
+		state.bindTexture( 32879, textureProperties.__webglTexture, 33984 + slot );
 
 	}
 
@@ -22719,8 +22731,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 
 		}
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( 34067, textureProperties.__webglTexture );
+		state.bindTexture( 34067, textureProperties.__webglTexture, 33984 + slot );
 
 	}
 
@@ -22892,13 +22903,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 		const forceUpload = initTexture( textureProperties, texture );
 		const source = texture.source;
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( textureType, textureProperties.__webglTexture );
+		state.bindTexture( textureType, textureProperties.__webglTexture, 33984 + slot );
 
 		const sourceProperties = properties.get( source );
 
 		if ( source.version !== sourceProperties.__version || forceUpload === true ) {
 
+			state.activeTexture( 33984 + slot );
+
 			_gl.pixelStorei( 37440, texture.flipY );
 			_gl.pixelStorei( 37441, texture.premultiplyAlpha );
 			_gl.pixelStorei( 3317, texture.unpackAlignment );
@@ -23253,13 +23265,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
 		const forceUpload = initTexture( textureProperties, texture );
 		const source = texture.source;
 
-		state.activeTexture( 33984 + slot );
-		state.bindTexture( 34067, textureProperties.__webglTexture );
+		state.bindTexture( 34067, textureProperties.__webglTexture, 33984 + slot );
 
 		const sourceProperties = properties.get( source );
 
 		if ( source.version !== sourceProperties.__version || forceUpload === true ) {
 
+			state.activeTexture( 33984 + slot );
+
 			_gl.pixelStorei( 37440, texture.flipY );
 			_gl.pixelStorei( 37441, texture.premultiplyAlpha );
 			_gl.pixelStorei( 3317, texture.unpackAlignment );

部分文件因为文件数量过多而无法显示