Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/loaders/CompressedTextureLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ import { Loader } from './Loader.js';
* Sub classes have to implement the parse() method which will be used in load().
*/

function CompressedTextureLoader( manager ) {
class CompressedTextureLoader extends Loader {

Loader.call( this, manager );
constructor( manager ) {

}

CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
super( manager );

constructor: CompressedTextureLoader,
}

load: function ( url, onLoad, onProgress, onError ) {
load( url, onLoad, onProgress, onError ) {

const scope = this;

Expand Down Expand Up @@ -130,7 +128,7 @@ CompressedTextureLoader.prototype = Object.assign( Object.create( Loader.prototy

}

} );
}


export { CompressedTextureLoader };
14 changes: 6 additions & 8 deletions src/loaders/DataTextureLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ import { Loader } from './Loader.js';
* Sub classes have to implement the parse() method which will be used in load().
*/

function DataTextureLoader( manager ) {
class DataTextureLoader extends Loader {

Loader.call( this, manager );
constructor( manager ) {

}

DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
super( manager );

constructor: DataTextureLoader,
}

load: function ( url, onLoad, onProgress, onError ) {
load( url, onLoad, onProgress, onError ) {

const scope = this;

Expand Down Expand Up @@ -110,7 +108,7 @@ DataTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ),

}

} );
}


export { DataTextureLoader };
22 changes: 10 additions & 12 deletions src/loaders/FileLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import { Loader } from './Loader.js';

const loading = {};

function FileLoader( manager ) {
class FileLoader extends Loader {

Loader.call( this, manager );
constructor( manager ) {

}

FileLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
super( manager );

constructor: FileLoader,
}

load: function ( url, onLoad, onProgress, onError ) {
load( url, onLoad, onProgress, onError ) {

if ( url === undefined ) url = '';

Expand Down Expand Up @@ -277,23 +275,23 @@ FileLoader.prototype = Object.assign( Object.create( Loader.prototype ), {

return request;

},
}

setResponseType: function ( value ) {
setResponseType( value ) {

this.responseType = value;
return this;

},
}

setMimeType: function ( value ) {
setMimeType( value ) {

this.mimeType = value;
return this;

}

} );
}


export { FileLoader };
36 changes: 17 additions & 19 deletions src/loaders/ImageBitmapLoader.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,37 @@
import { Cache } from './Cache.js';
import { Loader } from './Loader.js';

function ImageBitmapLoader( manager ) {
class ImageBitmapLoader extends Loader {

if ( typeof createImageBitmap === 'undefined' ) {
constructor( manager ) {

console.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );
super( manager );

}

if ( typeof fetch === 'undefined' ) {

console.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );
if ( typeof createImageBitmap === 'undefined' ) {

}
console.warn( 'THREE.ImageBitmapLoader: createImageBitmap() not supported.' );

Loader.call( this, manager );
}

this.options = { premultiplyAlpha: 'none' };
if ( typeof fetch === 'undefined' ) {

}
console.warn( 'THREE.ImageBitmapLoader: fetch() not supported.' );

ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
}

constructor: ImageBitmapLoader,
this.options = { premultiplyAlpha: 'none' };

isImageBitmapLoader: true,
}

setOptions: function setOptions( options ) {
setOptions( options ) {

this.options = options;

return this;

},
}

load: function ( url, onLoad, onProgress, onError ) {
load( url, onLoad, onProgress, onError ) {

if ( url === undefined ) url = '';

Expand Down Expand Up @@ -96,6 +92,8 @@ ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ),

}

} );
}

ImageBitmapLoader.prototype.isImageBitmapLoader = true;

export { ImageBitmapLoader };
46 changes: 23 additions & 23 deletions src/loaders/Loader.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { DefaultLoadingManager } from './LoadingManager.js';

function Loader( manager ) {
class Loader {

this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
constructor( manager ) {

this.crossOrigin = 'anonymous';
this.withCredentials = false;
this.path = '';
this.resourcePath = '';
this.requestHeader = {};
this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;

}
this.crossOrigin = 'anonymous';
this.withCredentials = false;
this.path = '';
this.resourcePath = '';
this.requestHeader = {};

Object.assign( Loader.prototype, {
}

load: function ( /* url, onLoad, onProgress, onError */ ) {},
load( /* url, onLoad, onProgress, onError */ ) {}

loadAsync: function ( url, onProgress ) {
loadAsync( url, onProgress ) {

const scope = this;

Expand All @@ -26,45 +26,45 @@ Object.assign( Loader.prototype, {

} );

},
}

parse: function ( /* data */ ) {},
parse( /* data */ ) {}

setCrossOrigin: function ( crossOrigin ) {
setCrossOrigin( crossOrigin ) {

this.crossOrigin = crossOrigin;
return this;

},
}

setWithCredentials: function ( value ) {
setWithCredentials( value ) {

this.withCredentials = value;
return this;

},
}

setPath: function ( path ) {
setPath( path ) {

this.path = path;
return this;

},
}

setResourcePath: function ( resourcePath ) {
setResourcePath( resourcePath ) {

this.resourcePath = resourcePath;
return this;

},
}

setRequestHeader: function ( requestHeader ) {
setRequestHeader( requestHeader ) {

this.requestHeader = requestHeader;
return this;

}

} );
}

export { Loader };
10 changes: 5 additions & 5 deletions src/loaders/LoaderUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const LoaderUtils = {
class LoaderUtils {

decodeText: function ( array ) {
static decodeText( array ) {

if ( typeof TextDecoder !== 'undefined' ) {

Expand Down Expand Up @@ -32,9 +32,9 @@ const LoaderUtils = {

}

},
}

extractUrlBase: function ( url ) {
static extractUrlBase( url ) {

const index = url.lastIndexOf( '/' );

Expand All @@ -44,6 +44,6 @@ const LoaderUtils = {

}

};
}

export { LoaderUtils };
Loading