瀏覽代碼

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 年之前
父節點
當前提交
7fb500cb33
共有 1 個文件被更改,包括 5 次插入1 次删除
  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 ) { }
 
 	};