|
@@ -25,7 +25,21 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
var scope = this;
|
|
|
|
|
|
- var path = this.path !== undefined ? 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 );
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
// Tells the LoadingManager to track an extra item, which resolves after
|
|
|
// the model is fully loaded. This means the count of items loaded will
|
|
@@ -51,13 +65,14 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
var loader = new THREE.FileLoader( scope.manager );
|
|
|
|
|
|
+ loader.setPath( this.path );
|
|
|
loader.setResponseType( 'arraybuffer' );
|
|
|
|
|
|
loader.load( url, function ( data ) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
- scope.parse( data, path, function ( gltf ) {
|
|
|
+ scope.parse( data, resourcePath, function ( gltf ) {
|
|
|
|
|
|
onLoad( gltf );
|
|
|
|
|
@@ -89,6 +104,13 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
},
|
|
|
|
|
|
+ setResourcePath: function ( value ) {
|
|
|
+
|
|
|
+ this.resourcePath = value;
|
|
|
+ return this;
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
setDRACOLoader: function ( dracoLoader ) {
|
|
|
|
|
|
this.dracoLoader = dracoLoader;
|
|
@@ -186,7 +208,7 @@ THREE.GLTFLoader = ( function () {
|
|
|
|
|
|
var parser = new GLTFParser( json, extensions, {
|
|
|
|
|
|
- path: path || this.path || '',
|
|
|
+ path: path || this.resourcePath || '',
|
|
|
crossOrigin: this.crossOrigin,
|
|
|
manager: this.manager
|
|
|
|