未验证 提交 2f46e2a6 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #14995 from Mugen87/dev2

Examples: Adjusted path handling in VRMLoader and LegacyGLTFLoader.
......@@ -54,6 +54,13 @@ THREE.VRMLoader = ( function () {
},
setResourcePath: function ( value ) {
this.glTFLoader.setResourcePath( value );
return this;
},
setDRACOLoader: function ( dracoLoader ) {
this.glTFLoader.setDRACOLoader( dracoLoader );
......
......@@ -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 || ''
} );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册