diff --git a/examples/js/loaders/VRMLoader.js b/examples/js/loaders/VRMLoader.js index 441497106f6ee8b5b442706e1b26ba421354894d..b9ccfe6b5f57d16bc5e192c9b209621930af4200 100644 --- a/examples/js/loaders/VRMLoader.js +++ b/examples/js/loaders/VRMLoader.js @@ -54,6 +54,13 @@ THREE.VRMLoader = ( function () { }, + setResourcePath: function ( value ) { + + this.glTFLoader.setResourcePath( value ); + return this; + + }, + setDRACOLoader: function ( dracoLoader ) { this.glTFLoader.setDRACOLoader( dracoLoader ); diff --git a/examples/js/loaders/deprecated/LegacyGLTFLoader.js b/examples/js/loaders/deprecated/LegacyGLTFLoader.js index 7d9b865ea0eb45bc13b999abf45aab00a68d3b82..339582a0439da4309873585985ac799e0267d1c7 100644 --- a/examples/js/loaders/deprecated/LegacyGLTFLoader.js +++ b/examples/js/loaders/deprecated/LegacyGLTFLoader.js @@ -23,15 +23,30 @@ THREE.LegacyGLTFLoader = ( function () { var scope = this; - var path = this.path && ( typeof this.path === "string" ) ? this.path : THREE.LoaderUtils.extractUrlBase( url ); + var resourcePath; + + if ( this.resourcePath !== undefined ) { + + resourcePath = this.resourcePath; + + } else if ( this.path !== undefined ) { + + resourcePath = this.path; + + } else { + + resourcePath = THREE.LoaderUtils.extractUrlBase( url ); + + } var loader = new THREE.FileLoader( scope.manager ); + loader.setPath( this.path ); loader.setResponseType( 'arraybuffer' ); loader.load( url, function ( data ) { - scope.parse( data, path, onLoad ); + scope.parse( data, resourcePath, onLoad ); }, onProgress, onError ); @@ -50,6 +65,13 @@ THREE.LegacyGLTFLoader = ( function () { }, + setResourcePath: function ( value ) { + + this.resourcePath = value; + return this; + + }, + parse: function ( data, path, callback ) { var content; @@ -80,7 +102,7 @@ THREE.LegacyGLTFLoader = ( function () { crossOrigin: this.crossOrigin, manager: this.manager, - path: path || this.path + path: path || this.resourcePath || '' } );