| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| THREE.VRMLoader = ( function () { |
|
|
| function VRMLoader( manager ) { |
|
|
| if ( THREE.GLTFLoader === undefined ) { |
|
|
| throw new Error( 'THREE.VRMLoader: Import THREE.GLTFLoader.' ); |
|
|
| } |
|
|
| this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; |
| this.gltfLoader = new THREE.GLTFLoader( this.manager ); |
|
|
| } |
|
|
| VRMLoader.prototype = { |
|
|
| constructor: VRMLoader, |
|
|
| crossOrigin: 'anonymous', |
|
|
| load: function ( url, onLoad, onProgress, onError ) { |
|
|
| var scope = this; |
|
|
| this.gltfLoader.load( url, function ( gltf ) { |
|
|
| scope.parse( gltf, onLoad ); |
|
|
| }, onProgress, onError ); |
|
|
| }, |
|
|
| setCrossOrigin: function ( value ) { |
|
|
| this.glTFLoader.setCrossOrigin( value ); |
| return this; |
|
|
| }, |
|
|
| setPath: function ( value ) { |
|
|
| this.glTFLoader.setPath( value ); |
| return this; |
|
|
| }, |
|
|
| setResourcePath: function ( value ) { |
|
|
| this.glTFLoader.setResourcePath( value ); |
| return this; |
|
|
| }, |
|
|
| setDRACOLoader: function ( dracoLoader ) { |
|
|
| this.glTFLoader.setDRACOLoader( dracoLoader ); |
| return this; |
|
|
| }, |
|
|
| parse: function ( gltf, onLoad ) { |
|
|
| var gltfParser = gltf.parser; |
| var gltfExtensions = gltf.userData.gltfExtensions || {}; |
| var vrmExtension = gltfExtensions.VRM || {}; |
|
|
| |
|
|
| onLoad( gltf ); |
|
|
| } |
|
|
| }; |
|
|
| return VRMLoader; |
|
|
| } )(); |
|
|