浏览代码

GLTFLoader: Remove support for MSFT_texture_dds.

Don McCurdy 4 年之前
父节点
当前提交
c1946d75cb

+ 0 - 7
docs/examples/en/loaders/GLTFLoader.html

@@ -38,7 +38,6 @@
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_meshopt_compression</li>
 			<li>EXT_meshopt_compression</li>
-			<li>MSFT_texture_dds</li>
 		</ul>
 		</ul>
 
 
 		<p>
 		<p>
@@ -205,12 +204,6 @@
 		Refer to this [link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme] for the details of Draco and its decoder.
 		Refer to this [link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme] for the details of Draco and its decoder.
 		</p>
 		</p>
 
 
-
-		<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
-		<p>
-		[page:DDSLoader ddsLoader] — Instance of THREE.DDSLoader, to be used for loading compressed textures with the MSFT_TEXTURE_DDS extension.
-		</p>
-
 		<h3>[method:null setKTX2Loader]( [param:KTX2Loader ktx2Loader] )</h3>
 		<h3>[method:null setKTX2Loader]( [param:KTX2Loader ktx2Loader] )</h3>
 		<p>
 		<p>
 		[page:KTX2Loader ktx2Loader] — Instance of THREE.KTX2Loader, to be used for loading KTX2 compressed textures.
 		[page:KTX2Loader ktx2Loader] — Instance of THREE.KTX2Loader, to be used for loading KTX2 compressed textures.

+ 0 - 6
docs/examples/zh/loaders/GLTFLoader.html

@@ -36,7 +36,6 @@
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_meshopt_compression</li>
 			<li>EXT_meshopt_compression</li>
-			<li>MSFT_texture_dds</li>
 		</ul>
 		</ul>
 
 
 		<p><i>
 		<p><i>
@@ -188,11 +187,6 @@
 		请参阅[link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme]来了解Draco及其解码器的详细信息。
 		请参阅[link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme]来了解Draco及其解码器的详细信息。
 		</p>
 		</p>
 
 
-		<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
-		<p>
-		[page:DDSLoader ddsLoader] — THREE.DDSLoader的实例,用于加载使用MSFT_TEXTURE_DDS扩展压缩过的纹理。
-		</p>
-
 		<h3>[method:null parse]( [param:ArrayBuffer data], [param:String path], [param:Function onLoad], [param:Function onError] )</h3>
 		<h3>[method:null parse]( [param:ArrayBuffer data], [param:String path], [param:Function onLoad], [param:Function onError] )</h3>
 		<p>
 		<p>
 		[page:ArrayBuffer data] — 需要解析的glTF文件,值为一个ArrayBuffer或<em>JSON</em>字符串。<br />
 		[page:ArrayBuffer data] — 需要解析的glTF文件,值为一个ArrayBuffer或<em>JSON</em>字符串。<br />

+ 9 - 41
examples/js/loaders/GLTFLoader.js

@@ -5,7 +5,6 @@ THREE.GLTFLoader = ( function () {
 		THREE.Loader.call( this, manager );
 		THREE.Loader.call( this, manager );
 
 
 		this.dracoLoader = null;
 		this.dracoLoader = null;
-		this.ddsLoader = null;
 		this.ktx2Loader = null;
 		this.ktx2Loader = null;
 		this.meshoptDecoder = null;
 		this.meshoptDecoder = null;
 
 
@@ -131,10 +130,13 @@ THREE.GLTFLoader = ( function () {
 
 
 		},
 		},
 
 
-		setDDSLoader: function ( ddsLoader ) {
+		setDDSLoader: function () {
 
 
-			this.ddsLoader = ddsLoader;
-			return this;
+			throw new Error(
+
+				'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
+
+			);
 
 
 		},
 		},
 
 
@@ -268,10 +270,6 @@ THREE.GLTFLoader = ( function () {
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							break;
 							break;
 
 
-						case EXTENSIONS.MSFT_TEXTURE_DDS:
-							extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
-							break;
-
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							break;
 							break;
@@ -354,29 +352,9 @@ THREE.GLTFLoader = ( function () {
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
-		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
-		MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
+		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
 	};
 	};
 
 
-	/**
-	 * DDS Texture Extension
-	 *
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
-	 *
-	 */
-	function GLTFTextureDDSExtension( ddsLoader ) {
-
-		if ( ! ddsLoader ) {
-
-			throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );
-
-		}
-
-		this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
-		this.ddsLoader = ddsLoader;
-
-	}
-
 	/**
 	/**
 	 * Punctual Lights Extension
 	 * Punctual Lights Extension
 	 *
 	 *
@@ -2387,15 +2365,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		var source;
 		var source;
 
 
-		if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {
-
-			source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];
-
-		} else {
-
-			source = json.images[ textureDef.source ];
-
-		}
+		source = json.images[ textureDef.source ];
 
 
 		var loader;
 		var loader;
 
 
@@ -2407,9 +2377,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		if ( ! loader ) {
 		if ( ! loader ) {
 
 
-			loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
-				? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
-				: this.textureLoader;
+			loader = this.textureLoader;
 
 
 		}
 		}
 
 

+ 10 - 42
examples/jsm/loaders/GLTFLoader.js

@@ -70,7 +70,6 @@ var GLTFLoader = ( function () {
 		Loader.call( this, manager );
 		Loader.call( this, manager );
 
 
 		this.dracoLoader = null;
 		this.dracoLoader = null;
-		this.ddsLoader = null;
 		this.ktx2Loader = null;
 		this.ktx2Loader = null;
 		this.meshoptDecoder = null;
 		this.meshoptDecoder = null;
 
 
@@ -196,10 +195,13 @@ var GLTFLoader = ( function () {
 
 
 		},
 		},
 
 
-		setDDSLoader: function ( ddsLoader ) {
+		setDDSLoader: function () {
 
 
-			this.ddsLoader = ddsLoader;
-			return this;
+			throw new Error(
+
+				'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
+
+			);
 
 
 		},
 		},
 
 
@@ -333,10 +335,6 @@ var GLTFLoader = ( function () {
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							break;
 							break;
 
 
-						case EXTENSIONS.MSFT_TEXTURE_DDS:
-							extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
-							break;
-
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							break;
 							break;
@@ -419,29 +417,9 @@ var GLTFLoader = ( function () {
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
-		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
-		MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
+		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
 	};
 	};
 
 
-	/**
-	 * DDS Texture Extension
-	 *
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
-	 *
-	 */
-	function GLTFTextureDDSExtension( ddsLoader ) {
-
-		if ( ! ddsLoader ) {
-
-			throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader' );
-
-		}
-
-		this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
-		this.ddsLoader = ddsLoader;
-
-	}
-
 	/**
 	/**
 	 * Punctual Lights Extension
 	 * Punctual Lights Extension
 	 *
 	 *
@@ -2452,15 +2430,7 @@ var GLTFLoader = ( function () {
 
 
 		var source;
 		var source;
 
 
-		if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {
-
-			source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];
-
-		} else {
-
-			source = json.images[ textureDef.source ];
-
-		}
+		source = json.images[ textureDef.source ];
 
 
 		var loader;
 		var loader;
 
 
@@ -2472,9 +2442,7 @@ var GLTFLoader = ( function () {
 
 
 		if ( ! loader ) {
 		if ( ! loader ) {
 
 
-			loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
-				? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
-				: this.textureLoader;
+			loader = this.textureLoader;
 
 
 		}
 		}
 
 
@@ -2631,7 +2599,7 @@ var GLTFLoader = ( function () {
 	 * Assigns final material to a Mesh, Line, or Points instance. The instance
 	 * Assigns final material to a Mesh, Line, or Points instance. The instance
 	 * already has a material (generated from the glTF material options alone)
 	 * already has a material (generated from the glTF material options alone)
 	 * but reuse of the same glTF material may require multiple threejs materials
 	 * but reuse of the same glTF material may require multiple threejs materials
-	 * to accomodate different primitive types, defines, etc. New materials will
+	 * to accommodate different primitive types, defines, etc. New materials will
 	 * be created if necessary, and reused from a cache.
 	 * be created if necessary, and reused from a cache.
 	 * @param  {Object3D} mesh Mesh, Line, or Points instance.
 	 * @param  {Object3D} mesh Mesh, Line, or Points instance.
 	 */
 	 */

二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox.bin


+ 0 - 237
examples/models/gltf/BoomBox/glTF-dds/BoomBox.gltf

@@ -1,237 +0,0 @@
-{
-  "accessors": [
-    {
-      "bufferView": 0,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC2",
-      "max": [
-        0.9999003,
-        -0.0221377648
-      ],
-      "min": [
-        0.0006585993,
-        -0.996773958
-      ]
-    },
-    {
-      "bufferView": 1,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC3",
-      "max": [
-        1.0,
-        1.0,
-        0.9999782
-      ],
-      "min": [
-        -1.0,
-        -1.0,
-        -0.9980823
-      ]
-    },
-    {
-      "bufferView": 2,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC4",
-      "max": [
-        1.0,
-        0.9999976,
-        1.0,
-        1.0
-      ],
-      "min": [
-        -0.9991289,
-        -0.999907851,
-        -1.0,
-        1.0
-      ]
-    },
-    {
-      "bufferView": 3,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC3",
-      "max": [
-        0.009921154,
-        0.00977163,
-        0.0100762453
-      ],
-      "min": [
-        -0.009921154,
-        -0.00977163,
-        -0.0100762453
-      ]
-    },
-    {
-      "bufferView": 4,
-      "componentType": 5123,
-      "count": 18108,
-      "type": "SCALAR",
-      "max": [
-        3574
-      ],
-      "min": [
-        0
-      ]
-    }
-  ],
-  "asset": {
-    "generator": "glTF Tools for Unity",
-    "version": "2.0"
-  },
-  "bufferViews": [
-    {
-      "buffer": 0,
-      "byteLength": 28600
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 28600,
-      "byteLength": 42900
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 71500,
-      "byteLength": 57200
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 128700,
-      "byteLength": 42900
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 171600,
-      "byteLength": 36216
-    }
-  ],
-  "buffers": [
-    {
-      "uri": "BoomBox.bin",
-      "byteLength": 207816
-    }
-  ],
-  "images": [
-    {
-      "uri": "BoomBox_baseColor.png"
-    },
-    {
-      "uri": "BoomBox_occlusionRoughnessMetallic.png"
-    },
-    {
-      "uri": "BoomBox_normal.png"
-    },
-    {
-      "uri": "BoomBox_emissive.png"
-    },
-    {
-      "uri": "BoomBox_baseColor.dds"
-    },
-    {
-      "uri": "BoomBox_occlusionRoughnessMetallic.dds"
-    },
-    {
-      "uri": "BoomBox_normal.dds"
-    },
-    {
-      "uri": "BoomBox_emissive.dds"
-    }
-  ],
-  "meshes": [
-    {
-      "primitives": [
-        {
-          "attributes": {
-            "TEXCOORD_0": 0,
-            "NORMAL": 1,
-            "TANGENT": 2,
-            "POSITION": 3
-          },
-          "indices": 4,
-          "material": 0
-        }
-      ],
-      "name": "BoomBox"
-    }
-  ],
-  "materials": [
-    {
-      "pbrMetallicRoughness": {
-        "baseColorTexture": {
-          "index": 0
-        },
-        "metallicRoughnessTexture": {
-          "index": 1
-        }
-      },
-      "normalTexture": {
-        "index": 2
-      },
-      "occlusionTexture": {
-        "index": 1
-      },
-      "emissiveFactor": [
-        1.0,
-        1.0,
-        1.0
-      ],
-      "emissiveTexture": {
-        "index": 3
-      },
-      "name": "BoomBox_Mat"
-    }
-  ],
-  "nodes": [
-    {
-      "mesh": 0,
-      "name": "BoomBox"
-    }
-  ],
-  "scene": 0,
-  "scenes": [
-    {
-      "nodes": [
-        0
-      ]
-    }
-  ],
-  "textures": [
-    {
-      "source": 0,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 4
-        }
-    }
-    },
-    {
-      "source": 1,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 5
-        }
-    }
-    },
-    {
-      "source": 2,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 6
-        }
-    }
-    },
-    {
-      "source": 3,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 7
-        }
-    }
-    }
-  ],
-  "extensionsUsed": [
-    "MSFT_texture_dds"
-  ]
-}

二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.dds


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.png


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.dds


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.png


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.dds


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.png


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.dds


二进制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.png


+ 1 - 4
examples/webgl_loader_gltf_extensions.html

@@ -21,7 +21,6 @@
 			import { GUI } from './jsm/libs/dat.gui.module.js';
 			import { GUI } from './jsm/libs/dat.gui.module.js';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
 			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
 			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
-			import { DDSLoader } from './jsm/loaders/DDSLoader.js';
 			import { DRACOLoader } from './jsm/loaders/DRACOLoader.js';
 			import { DRACOLoader } from './jsm/loaders/DRACOLoader.js';
 			import { RGBELoader } from './jsm/loaders/RGBELoader.js';
 			import { RGBELoader } from './jsm/loaders/RGBELoader.js';
 
 
@@ -39,7 +38,7 @@
 					authorURL: 'https://www.microsoft.com/',
 					authorURL: 'https://www.microsoft.com/',
 					cameraPos: new THREE.Vector3( 0.02, 0.01, 0.03 ),
 					cameraPos: new THREE.Vector3( 0.02, 0.01, 0.03 ),
 					objectRotation: new THREE.Euler( 0, Math.PI, 0 ),
 					objectRotation: new THREE.Euler( 0, Math.PI, 0 ),
-					extensions: [ 'glTF', 'glTF-pbrSpecularGlossiness', 'glTF-Binary', 'glTF-dds' ],
+					extensions: [ 'glTF', 'glTF-pbrSpecularGlossiness', 'glTF-Binary' ],
 					addEnvMap: true
 					addEnvMap: true
 				},
 				},
 				'Bot Skinned': {
 				'Bot Skinned': {
@@ -267,8 +266,6 @@
 				dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' );
 				dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' );
 				loader.setDRACOLoader( dracoLoader );
 				loader.setDRACOLoader( dracoLoader );
 
 
-				loader.setDDSLoader( new DDSLoader() );
-
 				let url = sceneInfo.url.replace( /%s/g, state.extension );
 				let url = sceneInfo.url.replace( /%s/g, state.extension );
 
 
 				if ( state.extension === 'glTF-Binary' ) {
 				if ( state.extension === 'glTF-Binary' ) {