|
@@ -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 || ''
|
|
|
|
|
|
} );
|
|
|
|