瀏覽代碼

VRMLoader prototype update

Takahiro 7 年之前
父節點
當前提交
fb141549f5
共有 1 個文件被更改,包括 19 次插入1 次删除
  1. 19 1
      examples/js/loaders/VRMLoader.js

+ 19 - 1
examples/js/loaders/VRMLoader.js

@@ -30,7 +30,13 @@ THREE.VRMLoader = ( function () {
 
 		load: function ( url, onLoad, onProgress, onError ) {
 
-			this.gltfLoader.load( url, onLoad, onProgress, onError );
+			var scope = this;
+
+			this.gltfLoader.load( url, function ( gltf ) {
+
+				scope.parse( gltf, onLoad );
+
+			}, onProgress, onError );
 
 		},
 
@@ -53,6 +59,18 @@ THREE.VRMLoader = ( function () {
 			this.glTFLoader.setDRACOLoader( dracoLoader );
 			return this;
 
+		},
+
+		parse: function ( gltf, onLoad ) {
+
+			var gltfParser = gltf.parser;
+			var gltfExtensions = gltf.userData.gltfExtensions || {};
+			var vrmExtension = gltfExtensions.VRM || {};
+
+			// handle VRM Extension here
+
+			onLoad( gltf );
+
 		}
 
 	};