浏览代码

Add error if DDSLoader is not present, remove unnecessary newrow

Anton Bergman 7 年之前
父节点
当前提交
7bdba7190c
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      examples/js/loaders/GLTFLoader.js

+ 7 - 0
examples/js/loaders/GLTFLoader.js

@@ -1786,6 +1786,7 @@ THREE.GLTFLoader = ( function () {
 	 * @return {Promise<THREE.Texture>}
 	 */
 	GLTFParser.prototype.loadTexture = function ( textureIndex ) {
+
 		var parser = this;
 		var json = this.json;
 		var options = this.options;
@@ -1800,6 +1801,12 @@ THREE.GLTFLoader = ( function () {
 		var source;
 		if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {
 
+			if (!THREE.DDSLoader) {
+
+				throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );
+
+			}
+
 			var DDSLoader = new THREE.DDSLoader;
 			source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];