Skip to content

Commit

Permalink
Examples: More usage of setPath() and setResourcePath() in loaders.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed Sep 20, 2018
1 parent da07e34 commit e12b7a2
Show file tree
Hide file tree
Showing 27 changed files with 271 additions and 48 deletions.
8 changes: 8 additions & 0 deletions docs/examples/loaders/BabylonLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ <h3>[method:Object3D parse]( [param:Object json] )</h3>
Lights are parsed accordingly.
</p>

<h3>[method:BabylonLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/BabylonLoader.js examples/js/loaders/BabylonLoader.js]
Expand Down
8 changes: 8 additions & 0 deletions docs/examples/loaders/PCDLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ <h3>[method:Object3D parse]( [param:Arraybuffer data],[param:String url] )</h3>
The object is converted to [page:Points] with a [page:BufferGeometry] and a [page:PointsMaterial].
</p>

<h3>[method:PCDLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PCDLoader.js examples/js/loaders/PCDLoader.js]
Expand Down
8 changes: 8 additions & 0 deletions docs/examples/loaders/PDBLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ <h3>[method:Object parse]( [param:String text] )</h3>
Parse a <em>pdb</em> text and return a <em>JSON</em> structure.<br />
</p>

<h3>[method:PDBLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]
Expand Down
8 changes: 8 additions & 0 deletions docs/examples/loaders/PRWMLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ <h3>PRWMLoader.isBigEndianPlatform( )</h3>
Return true if the endianness of the platform is Big Endian, false otherwise.
</p>

<h3>[method:PRWMLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PRWMLoader.js examples/js/loaders/PRWMLoader.js]
Expand Down
7 changes: 7 additions & 0 deletions docs/examples/loaders/SVGLoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ <h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Func
Begin loading from url and call onLoad with the response content.
</p>

<h3>[method:SVGLoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

Expand Down
8 changes: 8 additions & 0 deletions docs/examples/loaders/TGALoader.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ <h3>[method:DataTexture load]( [param:String url], [param:Function onLoad], [par
Begin loading from url and pass the loaded [page:DataTexture texture] to onLoad. The [page:DataTexture texture] is also directly returned for immediate use (but may not be fully loaded).
</p>

<h3>[method:TGALoader setPath]( [param:String path] )</h3>
<p>
[page:String path] — Base path.
</p>
<p>
Set the base path for the file.
</p>

<h2>Source</h2>

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/TGALoader.js examples/js/loaders/TGALoader.js]
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/3MFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THREE.ThreeMFLoader.prototype = {

var scope = this;
var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( buffer ) {

Expand All @@ -26,6 +27,13 @@ THREE.ThreeMFLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( data ) {

var scope = this;
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/AMFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ THREE.AMFLoader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( text ) {

Expand All @@ -42,6 +43,13 @@ THREE.AMFLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( data ) {

function loadDocument( data ) {
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/AWDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
this._baseDir = url.substr( 0, url.lastIndexOf( '/' ) + 1 );

var loader = new THREE.FileLoader( this.manager );
loader.setPath( this.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( text ) {

Expand All @@ -125,6 +126,13 @@

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( data ) {

var blen = data.byteLength;
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/BVHLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ THREE.BVHLoader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.load( url, function ( text ) {

onLoad( scope.parse( text ) );
Expand All @@ -34,6 +35,13 @@ THREE.BVHLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( text ) {

/*
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/BabylonLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ THREE.BabylonLoader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.load( url, function ( text ) {

onLoad( scope.parse( JSON.parse( text ) ) );
Expand All @@ -26,6 +27,13 @@ THREE.BabylonLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( json ) {

function parseMaterials( json ) {
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/GCodeLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ THREE.GCodeLoader.prototype.load = function ( url, onLoad, onProgress, onError )
var self = this;

var loader = new THREE.FileLoader( self.manager );
loader.setPath( self.path );
loader.load( url, function ( text ) {

onLoad( self.parse( text ) );
Expand All @@ -31,6 +32,13 @@ THREE.GCodeLoader.prototype.load = function ( url, onLoad, onProgress, onError )

};

THREE.GCodeLoader.prototype.setPath = function ( value ) {

this.path = value;
return this;

};

THREE.GCodeLoader.prototype.parse = function ( data ) {

var state = { x: 0, y: 0, z: 0, e: 0, f: 0, extruding: false, relative: false };
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/HDRCubeTextureLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ THREE.HDRCubeTextureLoader.prototype.load = function ( type, urls, onLoad, onPro
function loadHDRData( i, onLoad, onProgress, onError ) {

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( urls[ i ], function ( buffer ) {

Expand Down Expand Up @@ -184,3 +185,10 @@ THREE.HDRCubeTextureLoader.prototype.load = function ( type, urls, onLoad, onPro
return texture;

};

THREE.HDRCubeTextureLoader.prototype.setPath = function ( value ) {

this.path = value;
return this;

};
8 changes: 8 additions & 0 deletions examples/js/loaders/KMZLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THREE.KMZLoader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( text ) {

Expand All @@ -26,6 +27,13 @@ THREE.KMZLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( data ) {

function findFile( url ) {
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/MD2Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ THREE.MD2Loader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( buffer ) {

Expand All @@ -26,6 +27,13 @@ THREE.MD2Loader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: ( function () {

var normalData = [
Expand Down
8 changes: 8 additions & 0 deletions examples/js/loaders/NRRDLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ THREE.NRRDLoader.prototype = {
var scope = this;

var loader = new THREE.FileLoader( scope.manager );
loader.setPath( scope.path );
loader.setResponseType( 'arraybuffer' );
loader.load( url, function ( data ) {

Expand All @@ -23,6 +24,13 @@ THREE.NRRDLoader.prototype = {

},

setPath: function ( value ) {

this.path = value;
return this;

},

parse: function ( data ) {

// this parser is largely inspired from the XTK NRRD parser : https://github.com/xtk/X
Expand Down
Loading

0 comments on commit e12b7a2

Please sign in to comment.