소스 검색

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 ) { }
 
 	};