Przeglądaj źródła

GLTFLoader: Callback for when asset was read

Currently there is absolutely no possibility to access the asset property from the loaded GLTF. 
This here is one idea how it could look like. It is similar like "onAfterRender" etc where the developer just have to hook on the function to get the value.

Opinions regarding naming etc are welcome.
Also should we rather call this callback right after checking for the supported version or before?  The downside of the current code is that your callback won't be called if the GLTF version isn't supported, but then you normally won't have any need for the information in ```assets```...
Pascal Häusler 7 lat temu
rodzic
commit
7fb500cb33
1 zmienionych plików z 5 dodań i 1 usunięć
  1. 5 1
      examples/js/loaders/GLTFLoader.js

+ 5 - 1
examples/js/loaders/GLTFLoader.js

@@ -111,6 +111,8 @@ THREE.GLTFLoader = ( function () {
 
 			}
 
+			this.onAssetRead( json.asset );
+
 			if ( json.extensionsUsed ) {
 
 				if ( json.extensionsUsed.indexOf( EXTENSIONS.KHR_LIGHTS ) >= 0 ) {
@@ -158,7 +160,9 @@ THREE.GLTFLoader = ( function () {
 
 			}, onError );
 
-		}
+		},
+
+		onAssetRead: function ( assetValue ) { }
 
 	};