Browse Source

GLTFLoader: Clarify getDependency()

Takahiro 7 years ago
parent
commit
3756bfa006
1 changed files with 51 additions and 2 deletions
  1. 51 2
      examples/js/loaders/GLTFLoader.js

+ 51 - 2
examples/js/loaders/GLTFLoader.js

@@ -1482,8 +1482,57 @@ THREE.GLTFLoader = ( function () {
 
 
 		if ( ! dependency ) {
 		if ( ! dependency ) {
 
 
-			var fnName = 'load' + type.charAt( 0 ).toUpperCase() + type.slice( 1 );
-			dependency = this[ fnName ]( index );
+			switch ( type ) {
+
+				case 'scene':
+					dependency = this.loadScene( index );
+					break;
+
+				case 'node':
+					dependency = this.loadNode( index );
+					break;
+
+				case 'mesh':
+					dependency = this.loadMesh( index );
+					break;
+
+				case 'accessor':
+					dependency = this.loadAccessor( index );
+					break;
+
+				case 'bufferView':
+					dependency = this.loadBufferView( index );
+					break;
+
+				case 'buffer':
+					dependency = this.loadBuffer( index );
+					break;
+
+				case 'material':
+					dependency = this.loadMaterial( index );
+					break;
+
+				case 'texture':
+					dependency = this.loadTexture( index );
+					break;
+
+				case 'skin':
+					dependency = this.loadSkin( index );
+					break;
+
+				case 'animation':
+					dependency = this.loadAnimation( index );
+					break;
+
+				case 'camera':
+					dependency = this.loadCamera( index );
+					break;
+
+				default:
+					throw new Error( 'Unknown type: ' + type );
+
+			}
+
 			this.cache.add( cacheKey, dependency );
 			this.cache.add( cacheKey, dependency );
 
 
 		}
 		}