Browse Source

GLTFLoader: return asset via gltf object

Pascal Häusler 7 years ago
parent
commit
2003dc38b9
1 changed files with 6 additions and 8 deletions
  1. 6 8
      examples/js/loaders/GLTFLoader.js

+ 6 - 8
examples/js/loaders/GLTFLoader.js

@@ -111,8 +111,6 @@ THREE.GLTFLoader = ( function () {
 
 			}
 
-			this.onAssetRead( json.asset );
-
 			if ( json.extensionsUsed ) {
 
 				if ( json.extensionsUsed.indexOf( EXTENSIONS.KHR_LIGHTS ) >= 0 ) {
@@ -145,7 +143,7 @@ THREE.GLTFLoader = ( function () {
 
 			} );
 
-			parser.parse( function ( scene, scenes, cameras, animations ) {
+			parser.parse( function ( scene, scenes, cameras, animations, asset ) {
 
 				console.timeEnd( 'GLTFLoader' );
 
@@ -153,16 +151,15 @@ THREE.GLTFLoader = ( function () {
 					scene: scene,
 					scenes: scenes,
 					cameras: cameras,
-					animations: animations
+					animations: animations,
+					asset: asset
 				};
 
 				onLoad( glTF );
 
 			}, onError );
 
-		},
-
-		onAssetRead: function ( assetValue ) { }
+		}
 
 	};
 
@@ -1375,10 +1372,11 @@ THREE.GLTFLoader = ( function () {
 			var scenes = dependencies.scenes || [];
 			var scene = scenes[ json.scene || 0 ];
 			var animations = dependencies.animations || [];
+			var asset = json.asset;
 
 			parser.getDependencies( 'camera' ).then( function ( cameras ) {
 
-				onLoad( scene, scenes, cameras, animations );
+				onLoad( scene, scenes, cameras, animations, asset );
 
 			} ).catch( onError );