瀏覽代碼

Updated builds.

Mugen87 2 年之前
父節點
當前提交
0c0c62f250
共有 4 個文件被更改,包括 263 次插入60 次删除
  1. 73 20
      build/three.cjs
  2. 73 20
      build/three.js
  3. 0 0
      build/three.min.js
  4. 117 20
      build/three.module.js

+ 73 - 20
build/three.cjs

@@ -5964,7 +5964,7 @@ class Material extends EventDispatcher {
 		if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
 		if (this.thickness !== undefined) data.thickness = this.thickness;
 		if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
-		if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
+		if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
 		if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();
 		if (this.size !== undefined) data.size = this.size;
 		if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
@@ -14439,6 +14439,13 @@ function WebGLState(gl, extensions, capabilities) {
 			console.error('THREE.WebGLState:', error);
 		}
 	}
+	function compressedTexImage3D() {
+		try {
+			gl.compressedTexImage3D.apply(gl, arguments);
+		} catch (error) {
+			console.error('THREE.WebGLState:', error);
+		}
+	}
 	function texSubImage2D() {
 		try {
 			gl.texSubImage2D.apply(gl, arguments);
@@ -14460,6 +14467,13 @@ function WebGLState(gl, extensions, capabilities) {
 			console.error('THREE.WebGLState:', error);
 		}
 	}
+	function compressedTexSubImage3D() {
+		try {
+			gl.compressedTexSubImage3D.apply(gl, arguments);
+		} catch (error) {
+			console.error('THREE.WebGLState:', error);
+		}
+	}
 	function texStorage2D() {
 		try {
 			gl.texStorage2D.apply(gl, arguments);
@@ -14615,6 +14629,7 @@ function WebGLState(gl, extensions, capabilities) {
 		bindTexture: bindTexture,
 		unbindTexture: unbindTexture,
 		compressedTexImage2D: compressedTexImage2D,
+		compressedTexImage3D: compressedTexImage3D,
 		texImage2D: texImage2D,
 		texImage3D: texImage3D,
 		updateUBOMapping: updateUBOMapping,
@@ -14624,6 +14639,7 @@ function WebGLState(gl, extensions, capabilities) {
 		texSubImage2D: texSubImage2D,
 		texSubImage3D: texSubImage3D,
 		compressedTexSubImage2D: compressedTexSubImage2D,
+		compressedTexSubImage3D: compressedTexSubImage3D,
 		scissor: scissor,
 		viewport: viewport,
 		reset: reset
@@ -14878,6 +14894,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 		const array = [];
 		array.push(texture.wrapS);
 		array.push(texture.wrapT);
+		array.push(texture.wrapR || 0);
 		array.push(texture.magFilter);
 		array.push(texture.minFilter);
 		array.push(texture.anisotropy);
@@ -15040,7 +15057,7 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 	}
 	function uploadTexture(textureProperties, texture, slot) {
 		let textureType = _gl.TEXTURE_2D;
-		if (texture.isDataArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
+		if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
 		if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
 		const forceUpload = initTexture(textureProperties, texture);
 		const source = texture.source;
@@ -15150,26 +15167,52 @@ function WebGLTextures(_gl, extensions, state, properties, capabilities, utils,
 					}
 				}
 			} else if (texture.isCompressedTexture) {
-				if (useTexStorage && allocateMemory) {
-					state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
-				}
-				for (let i = 0, il = mipmaps.length; i < il; i++) {
-					mipmap = mipmaps[i];
-					if (texture.format !== RGBAFormat) {
-						if (glFormat !== null) {
-							if (useTexStorage) {
-								state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
+				if (texture.isCompressedArrayTexture) {
+					if (useTexStorage && allocateMemory) {
+						state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
+					}
+					for (let i = 0, il = mipmaps.length; i < il; i++) {
+						mipmap = mipmaps[i];
+						if (texture.format !== RGBAFormat) {
+							if (glFormat !== null) {
+								if (useTexStorage) {
+									state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);
+								} else {
+									state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);
+								}
 							} else {
-								state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+								console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
 							}
 						} else {
-							console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
+							if (useTexStorage) {
+								state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
+							} else {
+								state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
+							}
 						}
-					} else {
-						if (useTexStorage) {
-							state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
+					}
+				} else {
+					if (useTexStorage && allocateMemory) {
+						state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
+					}
+					for (let i = 0, il = mipmaps.length; i < il; i++) {
+						mipmap = mipmaps[i];
+						if (texture.format !== RGBAFormat) {
+							if (glFormat !== null) {
+								if (useTexStorage) {
+									state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
+								} else {
+									state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+								}
+							} else {
+								console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
+							}
 						} else {
-							state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+							if (useTexStorage) {
+								state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
+							} else {
+								state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+							}
 						}
 					}
 				}
@@ -18491,7 +18534,7 @@ function WebGLRenderer(parameters = {}) {
 		let isRenderTarget3D = false;
 		if (renderTarget) {
 			const texture = renderTarget.texture;
-			if (texture.isData3DTexture || texture.isDataArrayTexture) {
+			if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
 				isRenderTarget3D = true;
 			}
 			const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;
@@ -18643,7 +18686,7 @@ function WebGLRenderer(parameters = {}) {
 		if (srcTexture.isDataTexture || srcTexture.isData3DTexture) {
 			_gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
 		} else {
-			if (srcTexture.isCompressedTexture) {
+			if (srcTexture.isCompressedArrayTexture) {
 				console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
 				_gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
 			} else {
@@ -18665,7 +18708,7 @@ function WebGLRenderer(parameters = {}) {
 			textures.setTextureCube(texture, 0);
 		} else if (texture.isData3DTexture) {
 			textures.setTexture3D(texture, 0);
-		} else if (texture.isDataArrayTexture) {
+		} else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
 			textures.setTexture2DArray(texture, 0);
 		} else {
 			textures.setTexture2D(texture, 0);
@@ -20017,6 +20060,15 @@ class CompressedTexture extends Texture {
 	}
 }
 
+class CompressedArrayTexture extends CompressedTexture {
+	constructor(mipmaps, width, height, depth, format, type) {
+		super(mipmaps, width, height, format, type);
+		this.isCompressedArrayTexture = true;
+		this.image.depth = depth;
+		this.wrapR = ClampToEdgeWrapping;
+	}
+}
+
 class CanvasTexture extends Texture {
 	constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
 		super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
@@ -32160,6 +32212,7 @@ exports.Clock = Clock;
 exports.Color = Color;
 exports.ColorKeyframeTrack = ColorKeyframeTrack;
 exports.ColorManagement = ColorManagement;
+exports.CompressedArrayTexture = CompressedArrayTexture;
 exports.CompressedTexture = CompressedTexture;
 exports.CompressedTextureLoader = CompressedTextureLoader;
 exports.ConeBufferGeometry = ConeBufferGeometry;

+ 73 - 20
build/three.js

@@ -5966,7 +5966,7 @@
 			if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
 			if (this.thickness !== undefined) data.thickness = this.thickness;
 			if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
-			if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
+			if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
 			if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();
 			if (this.size !== undefined) data.size = this.size;
 			if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
@@ -14441,6 +14441,13 @@
 				console.error('THREE.WebGLState:', error);
 			}
 		}
+		function compressedTexImage3D() {
+			try {
+				gl.compressedTexImage3D.apply(gl, arguments);
+			} catch (error) {
+				console.error('THREE.WebGLState:', error);
+			}
+		}
 		function texSubImage2D() {
 			try {
 				gl.texSubImage2D.apply(gl, arguments);
@@ -14462,6 +14469,13 @@
 				console.error('THREE.WebGLState:', error);
 			}
 		}
+		function compressedTexSubImage3D() {
+			try {
+				gl.compressedTexSubImage3D.apply(gl, arguments);
+			} catch (error) {
+				console.error('THREE.WebGLState:', error);
+			}
+		}
 		function texStorage2D() {
 			try {
 				gl.texStorage2D.apply(gl, arguments);
@@ -14617,6 +14631,7 @@
 			bindTexture: bindTexture,
 			unbindTexture: unbindTexture,
 			compressedTexImage2D: compressedTexImage2D,
+			compressedTexImage3D: compressedTexImage3D,
 			texImage2D: texImage2D,
 			texImage3D: texImage3D,
 			updateUBOMapping: updateUBOMapping,
@@ -14626,6 +14641,7 @@
 			texSubImage2D: texSubImage2D,
 			texSubImage3D: texSubImage3D,
 			compressedTexSubImage2D: compressedTexSubImage2D,
+			compressedTexSubImage3D: compressedTexSubImage3D,
 			scissor: scissor,
 			viewport: viewport,
 			reset: reset
@@ -14880,6 +14896,7 @@
 			const array = [];
 			array.push(texture.wrapS);
 			array.push(texture.wrapT);
+			array.push(texture.wrapR || 0);
 			array.push(texture.magFilter);
 			array.push(texture.minFilter);
 			array.push(texture.anisotropy);
@@ -15042,7 +15059,7 @@
 		}
 		function uploadTexture(textureProperties, texture, slot) {
 			let textureType = _gl.TEXTURE_2D;
-			if (texture.isDataArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
+			if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
 			if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
 			const forceUpload = initTexture(textureProperties, texture);
 			const source = texture.source;
@@ -15152,26 +15169,52 @@
 						}
 					}
 				} else if (texture.isCompressedTexture) {
-					if (useTexStorage && allocateMemory) {
-						state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
-					}
-					for (let i = 0, il = mipmaps.length; i < il; i++) {
-						mipmap = mipmaps[i];
-						if (texture.format !== RGBAFormat) {
-							if (glFormat !== null) {
-								if (useTexStorage) {
-									state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
+					if (texture.isCompressedArrayTexture) {
+						if (useTexStorage && allocateMemory) {
+							state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
+						}
+						for (let i = 0, il = mipmaps.length; i < il; i++) {
+							mipmap = mipmaps[i];
+							if (texture.format !== RGBAFormat) {
+								if (glFormat !== null) {
+									if (useTexStorage) {
+										state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);
+									} else {
+										state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);
+									}
 								} else {
-									state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+									console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
 								}
 							} else {
-								console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
+								if (useTexStorage) {
+									state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
+								} else {
+									state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
+								}
 							}
-						} else {
-							if (useTexStorage) {
-								state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
+						}
+					} else {
+						if (useTexStorage && allocateMemory) {
+							state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
+						}
+						for (let i = 0, il = mipmaps.length; i < il; i++) {
+							mipmap = mipmaps[i];
+							if (texture.format !== RGBAFormat) {
+								if (glFormat !== null) {
+									if (useTexStorage) {
+										state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
+									} else {
+										state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
+									}
+								} else {
+									console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
+								}
 							} else {
-								state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+								if (useTexStorage) {
+									state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
+								} else {
+									state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
+								}
 							}
 						}
 					}
@@ -18493,7 +18536,7 @@
 			let isRenderTarget3D = false;
 			if (renderTarget) {
 				const texture = renderTarget.texture;
-				if (texture.isData3DTexture || texture.isDataArrayTexture) {
+				if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
 					isRenderTarget3D = true;
 				}
 				const __webglFramebuffer = properties.get(renderTarget).__webglFramebuffer;
@@ -18645,7 +18688,7 @@
 			if (srcTexture.isDataTexture || srcTexture.isData3DTexture) {
 				_gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
 			} else {
-				if (srcTexture.isCompressedTexture) {
+				if (srcTexture.isCompressedArrayTexture) {
 					console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
 					_gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
 				} else {
@@ -18667,7 +18710,7 @@
 				textures.setTextureCube(texture, 0);
 			} else if (texture.isData3DTexture) {
 				textures.setTexture3D(texture, 0);
-			} else if (texture.isDataArrayTexture) {
+			} else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
 				textures.setTexture2DArray(texture, 0);
 			} else {
 				textures.setTexture2D(texture, 0);
@@ -20019,6 +20062,15 @@
 		}
 	}
 
+	class CompressedArrayTexture extends CompressedTexture {
+		constructor(mipmaps, width, height, depth, format, type) {
+			super(mipmaps, width, height, format, type);
+			this.isCompressedArrayTexture = true;
+			this.image.depth = depth;
+			this.wrapR = ClampToEdgeWrapping;
+		}
+	}
+
 	class CanvasTexture extends Texture {
 		constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
 			super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
@@ -32162,6 +32214,7 @@
 	exports.Color = Color;
 	exports.ColorKeyframeTrack = ColorKeyframeTrack;
 	exports.ColorManagement = ColorManagement;
+	exports.CompressedArrayTexture = CompressedArrayTexture;
 	exports.CompressedTexture = CompressedTexture;
 	exports.CompressedTextureLoader = CompressedTextureLoader;
 	exports.ConeBufferGeometry = ConeBufferGeometry;

文件差異過大導致無法顯示
+ 0 - 0
build/three.min.js


文件差異過大導致無法顯示
+ 117 - 20
build/three.module.js


部分文件因文件數量過多而無法顯示