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

Merge pull request #14989 from Mugen87/dev7

Loaders: Added missing .setPath() in remaining core loaders.
......@@ -81,6 +81,14 @@
be parsed with [page:AnimationClip.parse].
</p>
<h3>[method:AnimationLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path of the file to load.<br /><br />
Sets the base path or URL from which to load files. This can be useful if
you are loading many animations from the same directory.
</p>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -92,6 +92,14 @@
Begin loading from url and pass the loaded [page:String AudioBuffer] to onLoad.
</p>
<h3>[method:AudioLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path of the file to load.<br /><br />
Sets the base path or URL from which to load files. This can be useful if
you are loading many audios from the same directory.
</p>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -85,6 +85,14 @@
Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
</p>
<h3>[method:BufferGeometryLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path of the file to load.<br /><br />
Sets the base path or URL from which to load files. This can be useful if
you are loading many geometries from the same directory.
</p>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -56,6 +56,14 @@
Begin loading from url and pass the loaded texture to onLoad.
</p>
<h3>[method:DataTextureLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path of the file to load.<br /><br />
Sets the base path or URL from which to load files. This can be useful if
you are loading many data textures from the same directory.
</p>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
......
......@@ -84,12 +84,18 @@
Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
</p>
<h3>[method:null setTextures]( [param:Object textures] )</h3>
<h3>[method:MaterialLoader setPath]( [param:String path] )</h3>
<p>
[page:Object textures] — object containing any textures used by the material.
</p>
[page:String path] — Base path of the file to load.<br /><br />
Sets the base path or URL from which to load files. This can be useful if
you are loading many materials from the same directory.
</p>
<h3>[method:MaterialLoader setTextures]( [param:Object textures] )</h3>
<p>
[page:Object textures] — object containing any textures used by the material.
</p>
<h2>Source</h2>
......
......@@ -19,6 +19,7 @@ Object.assign( AnimationLoader.prototype, {
var scope = this;
var loader = new FileLoader( scope.manager );
loader.setPath( scope.path );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
......@@ -41,6 +42,13 @@ Object.assign( AnimationLoader.prototype, {
onLoad( animations );
},
setPath: function ( value ) {
this.path = value;
return this;
}
} );
......
......@@ -18,6 +18,7 @@ Object.assign( AudioLoader.prototype, {
var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' );
loader.setPath( this.path );
loader.load( url, function ( buffer ) {
// Create a copy of the buffer. The `decodeAudioData` method
......@@ -33,6 +34,13 @@ Object.assign( AudioLoader.prototype, {
}, onProgress, onError );
},
setPath: function ( value ) {
this.path = value;
return this;
}
} );
......
......@@ -22,6 +22,7 @@ Object.assign( BufferGeometryLoader.prototype, {
var scope = this;
var loader = new FileLoader( scope.manager );
loader.setPath( scope.path );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
......@@ -86,6 +87,13 @@ Object.assign( BufferGeometryLoader.prototype, {
return geometry;
},
setPath: function ( value ) {
this.path = value;
return this;
}
} );
......
......@@ -28,7 +28,7 @@ Object.assign( DataTextureLoader.prototype, {
var loader = new FileLoader( this.manager );
loader.setResponseType( 'arraybuffer' );
loader.setPath( this.path );
loader.load( url, function ( buffer ) {
var texData = scope._parser( buffer );
......@@ -87,6 +87,13 @@ Object.assign( DataTextureLoader.prototype, {
return texture;
},
setPath: function ( value ) {
this.path = value;
return this;
}
} );
......
......@@ -25,6 +25,7 @@ Object.assign( MaterialLoader.prototype, {
var scope = this;
var loader = new FileLoader( scope.manager );
loader.setPath( scope.path );
loader.load( url, function ( text ) {
onLoad( scope.parse( JSON.parse( text ) ) );
......@@ -33,12 +34,6 @@ Object.assign( MaterialLoader.prototype, {
},
setTextures: function ( value ) {
this.textures = value;
},
parse: function ( json ) {
var textures = this.textures;
......@@ -219,6 +214,20 @@ Object.assign( MaterialLoader.prototype, {
return material;
},
setPath: function ( value ) {
this.path = value;
return this;
},
setTextures: function ( value ) {
this.textures = value;
return this;
}
} );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册