2
0
Эх сурвалжийг харах

Merge pull request #17363 from Mugen87/dev37

Examples: Inherit loaders from Loader I.
Michael Herzog 6 жил өмнө
parent
commit
8a2a68bb31
60 өөрчлөгдсөн 212 нэмэгдсэн , 824 устгасан
  1. 4 9
      docs/examples/en/loaders/BabylonLoader.html
  2. 5 8
      docs/examples/en/loaders/BasisTextureLoader.html
  3. 4 13
      docs/examples/en/loaders/DRACOLoader.html
  4. 4 9
      docs/examples/zh/loaders/BabylonLoader.html
  5. 5 8
      docs/examples/zh/loaders/BasisTextureLoader.html
  6. 4 13
      docs/examples/zh/loaders/DRACOLoader.html
  7. 4 10
      examples/js/loaders/3MFLoader.js
  8. 3 10
      examples/js/loaders/AMFLoader.js
  9. 3 10
      examples/js/loaders/AWDLoader.js
  10. 4 27
      examples/js/loaders/AssimpJSONLoader.js
  11. 4 27
      examples/js/loaders/AssimpLoader.js
  12. 3 10
      examples/js/loaders/BVHLoader.js
  13. 3 10
      examples/js/loaders/BabylonLoader.js
  14. 4 13
      examples/js/loaders/BasisTextureLoader.js
  15. 4 27
      examples/js/loaders/ColladaLoader.js
  16. 4 22
      examples/js/loaders/DRACOLoader.js
  17. 5 28
      examples/js/loaders/FBXLoader.js
  18. 3 10
      examples/js/loaders/GCodeLoader.js
  19. 3 10
      examples/js/loaders/KMZLoader.js
  20. 3 10
      examples/js/loaders/PLYLoader.js
  21. 3 10
      examples/js/loaders/PlayCanvasLoader.js
  22. 3 10
      examples/js/loaders/STLLoader.js
  23. 6 52
      examples/js/loaders/TDSLoader.js
  24. 4 27
      examples/js/loaders/VRMLLoader.js
  25. 2 4
      examples/jsm/loaders/3MFLoader.d.ts
  26. 5 11
      examples/jsm/loaders/3MFLoader.js
  27. 2 4
      examples/jsm/loaders/AMFLoader.d.ts
  28. 4 11
      examples/jsm/loaders/AMFLoader.js
  29. 2 3
      examples/jsm/loaders/AWDLoader.d.ts
  30. 4 11
      examples/jsm/loaders/AWDLoader.js
  31. 2 8
      examples/jsm/loaders/AssimpJSONLoader.d.ts
  32. 5 28
      examples/jsm/loaders/AssimpJSONLoader.js
  33. 2 8
      examples/jsm/loaders/AssimpLoader.d.ts
  34. 5 28
      examples/jsm/loaders/AssimpLoader.js
  35. 2 5
      examples/jsm/loaders/BVHLoader.d.ts
  36. 4 11
      examples/jsm/loaders/BVHLoader.js
  37. 2 4
      examples/jsm/loaders/BabylonLoader.d.ts
  38. 4 11
      examples/jsm/loaders/BabylonLoader.js
  39. 2 4
      examples/jsm/loaders/BasisTextureLoader.d.ts
  40. 5 14
      examples/jsm/loaders/BasisTextureLoader.js
  41. 2 9
      examples/jsm/loaders/ColladaLoader.d.ts
  42. 5 28
      examples/jsm/loaders/ColladaLoader.js
  43. 2 3
      examples/jsm/loaders/DRACOLoader.d.ts
  44. 6 24
      examples/jsm/loaders/DRACOLoader.js
  45. 2 9
      examples/jsm/loaders/FBXLoader.d.ts
  46. 5 28
      examples/jsm/loaders/FBXLoader.js
  47. 2 5
      examples/jsm/loaders/GCodeLoader.d.ts
  48. 5 12
      examples/jsm/loaders/GCodeLoader.js
  49. 2 4
      examples/jsm/loaders/KMZLoader.d.ts
  50. 4 11
      examples/jsm/loaders/KMZLoader.js
  51. 2 5
      examples/jsm/loaders/PLYLoader.d.ts
  52. 4 11
      examples/jsm/loaders/PLYLoader.js
  53. 2 4
      examples/jsm/loaders/PlayCanvasLoader.d.ts
  54. 4 11
      examples/jsm/loaders/PlayCanvasLoader.js
  55. 2 5
      examples/jsm/loaders/STLLoader.d.ts
  56. 4 11
      examples/jsm/loaders/STLLoader.js
  57. 2 7
      examples/jsm/loaders/TDSLoader.d.ts
  58. 6 52
      examples/jsm/loaders/TDSLoader.js
  59. 2 9
      examples/jsm/loaders/VRMLLoader.d.ts
  60. 5 28
      examples/jsm/loaders/VRMLLoader.js

+ 4 - 9
docs/examples/en/loaders/BabylonLoader.html

@@ -8,6 +8,8 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	<body>
+		[page:Loader] &rarr;
+
 		<h1>[name]</h1>
 
 		<p class="desc">A loader for loading a <em>.babylon</em> resource. <br />
@@ -59,9 +61,10 @@
 		</p>
 
 		<h2>Properties</h2>
-
+		<p>See the base [page:Loader] class for common properties.</p>
 
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -84,14 +87,6 @@
 		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>
 
 		<p>

+ 5 - 8
docs/examples/en/loaders/BasisTextureLoader.html

@@ -9,6 +9,7 @@
 	</head>
 	<body>
 		[page:Loader] &rarr;
+
 		<h1>[name]</h1>
 
 		<p class="desc">
@@ -81,7 +82,11 @@
 		Creates a new [name].
 		</p>
 
+		<h2>Properties</h2>
+		<p>See the base [page:Loader] class for common properties.</p>
+
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -103,14 +108,6 @@
 		the output format for the transcoder. Must be called before loading a texture.
 		</p>
 
-		<h3>[method:this setCrossOrigin]( [param:String crossOrigin] )</h3>
-		<p>
-		[page:String crossOrigin] — Options are '', 'anonymous', or 'use-credentials'. Default is 'anonymous'.
-		</p>
-		<p>
-		Sets options for CORS requests.
-		</p>
-
 		<h3>[method:this setTranscoderPath]( [param:String path] )</h3>
 		<p>
 		[page:String path] — Path to folder containing the WASM transcoder and JS wrapper.

+ 4 - 13
docs/examples/en/loaders/DRACOLoader.html

@@ -87,7 +87,11 @@
 		Creates a new [name].
 		</p>
 
+		<h2>Properties</h2>
+		<p>See the base [page:Loader] class for common properties.</p>
+
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -100,19 +104,6 @@
 		Begin loading from url and call the <em>onLoad</em> function with the decompressed geometry.
 		</p>
 
-		<h3>[method:this setPath]( [param:String path] )</h3>
-		<p>
-		[page:String path] — Base path.
-		</p>
-		<p>
-		Set the base path for the <em>.drc</em> file.
-		</p>
-
-		<h3>[method:this setCrossOrigin]( [param:String value] )</h3>
-		<p>
-		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
-		</p>
-
 		<h3>[method:this setDecoderPath]( [param:String value] )</h3>
 		<p>
 		[page:String value] — Path to folder containing the JS and WASM decoder libraries.

+ 4 - 9
docs/examples/zh/loaders/BabylonLoader.html

@@ -8,6 +8,8 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	<body>
+		[page:Loader] &rarr;
+
 		<h1>[name]</h1>
 
 		<p class="desc">A loader for loading a <em>.babylon</em> resource. <br />
@@ -59,9 +61,10 @@
 		</p>
 
 		<h2>Properties</h2>
-
+		<p>See the base [page:Loader] class for common properties.</p>
 
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -84,14 +87,6 @@
 		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>
 
 		<p>

+ 5 - 8
docs/examples/zh/loaders/BasisTextureLoader.html

@@ -9,6 +9,7 @@
 	</head>
 	<body>
 		[page:Loader] &rarr;
+
 		<h1>[name]</h1>
 
 		<p class="desc">
@@ -81,7 +82,11 @@
 		Creates a new [name].
 		</p>
 
+		<h2>Properties</h2>
+		<p>See the base [page:Loader] class for common properties.</p>
+
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -103,14 +108,6 @@
 		the output format for the transcoder. Must be called before loading a texture.
 		</p>
 
-		<h3>[method:this setCrossOrigin]( [param:String crossOrigin] )</h3>
-		<p>
-		[page:String crossOrigin] — Options are '', 'anonymous', or 'use-credentials'. Default is 'anonymous'.
-		</p>
-		<p>
-		Sets options for CORS requests.
-		</p>
-
 		<h3>[method:this setTranscoderPath]( [param:String path] )</h3>
 		<p>
 		[page:String path] — Path to folder containing the WASM transcoder and JS wrapper.

+ 4 - 13
docs/examples/zh/loaders/DRACOLoader.html

@@ -87,7 +87,11 @@
 		Creates a new [name].
 		</p>
 
+		<h2>Properties</h2>
+		<p>See the base [page:Loader] class for common properties.</p>
+
 		<h2>Methods</h2>
+		<p>See the base [page:Loader] class for common methods.</p>
 
 		<h3>[method:null load]( [param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError] )</h3>
 		<p>
@@ -100,19 +104,6 @@
 		Begin loading from url and call the <em>onLoad</em> function with the decompressed geometry.
 		</p>
 
-		<h3>[method:this setPath]( [param:String path] )</h3>
-		<p>
-		[page:String path] — Base path.
-		</p>
-		<p>
-		Set the base path for the <em>.drc</em> file.
-		</p>
-
-		<h3>[method:this setCrossOrigin]( [param:String value] )</h3>
-		<p>
-		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
-		</p>
-
 		<h3>[method:this setDecoderPath]( [param:String value] )</h3>
 		<p>
 		[page:String value] — Path to folder containing the JS and WASM decoder libraries.

+ 4 - 10
examples/js/loaders/3MFLoader.js

@@ -16,12 +16,13 @@
 
 THREE.ThreeMFLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
+
 	this.availableExtensions = [];
 
 };
 
-THREE.ThreeMFLoader.prototype = {
+THREE.ThreeMFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.ThreeMFLoader,
 
@@ -39,13 +40,6 @@ THREE.ThreeMFLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		var scope = this;
@@ -926,4 +920,4 @@ THREE.ThreeMFLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/AMFLoader.js

@@ -20,11 +20,11 @@
 
 THREE.AMFLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.AMFLoader.prototype = {
+THREE.AMFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.AMFLoader,
 
@@ -43,13 +43,6 @@ THREE.AMFLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function loadDocument( data ) {
@@ -492,4 +485,4 @@ THREE.AMFLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/AWDLoader.js

@@ -80,7 +80,7 @@ THREE.AWDLoader = ( function () {
 
 	var AWDLoader = function ( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+		THREE.Loader.call( this, manager );
 
 		this.trunk = new THREE.Object3D();
 
@@ -106,7 +106,7 @@ THREE.AWDLoader = ( function () {
 
 	};
 
-	AWDLoader.prototype = {
+	AWDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 		constructor: AWDLoader,
 
@@ -128,13 +128,6 @@ THREE.AWDLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
 		parse: function ( data ) {
 
 			var blen = data.byteLength;
@@ -1219,7 +1212,7 @@ THREE.AWDLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	return AWDLoader;
 

+ 4 - 27
examples/js/loaders/AssimpJSONLoader.js

@@ -13,21 +13,19 @@
 
 THREE.AssimpJSONLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.AssimpJSONLoader.prototype = {
+THREE.AssimpJSONLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.AssimpJSONLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new THREE.FileLoader( this.manager );
 		loader.setPath( scope.path );
@@ -65,27 +63,6 @@ THREE.AssimpJSONLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( json, path ) {
 
 		function parseList( json, handler ) {
@@ -290,4 +267,4 @@ THREE.AssimpJSONLoader.prototype = {
 
 	}
 
-};
+} );

+ 4 - 27
examples/js/loaders/AssimpLoader.js

@@ -4,21 +4,19 @@
 
 THREE.AssimpLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.AssimpLoader.prototype = {
+THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.AssimpLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new THREE.FileLoader( this.manager );
 		loader.setPath( scope.path );
@@ -32,27 +30,6 @@ THREE.AssimpLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( buffer, path ) {
 
 		var textureLoader = new THREE.TextureLoader( this.manager );
@@ -2274,4 +2251,4 @@ THREE.AssimpLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/BVHLoader.js

@@ -10,14 +10,14 @@
 
 THREE.BVHLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 	this.animateBonePositions = true;
 	this.animateBoneRotations = true;
 
 };
 
-THREE.BVHLoader.prototype = {
+THREE.BVHLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.BVHLoader,
 
@@ -35,13 +35,6 @@ THREE.BVHLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( text ) {
 
 		/*
@@ -411,4 +404,4 @@ THREE.BVHLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/BabylonLoader.js

@@ -5,11 +5,11 @@
 
 THREE.BabylonLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.BabylonLoader.prototype = {
+THREE.BabylonLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.BabylonLoader,
 
@@ -27,13 +27,6 @@ THREE.BabylonLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( json ) {
 
 		function parseMaterials( json ) {
@@ -252,4 +245,4 @@ THREE.BabylonLoader.prototype = {
 
 	}
 
-};
+} );

+ 4 - 13
examples/js/loaders/BasisTextureLoader.js

@@ -20,9 +20,7 @@
  */
 THREE.BasisTextureLoader = function ( manager ) {
 
-	this.manager = manager || THREE.DefaultLoadingManager;
-
-	this.crossOrigin = 'anonymous';
+	THREE.Loader.call( this, manager );
 
 	this.transcoderPath = '';
 	this.transcoderBinary = null;
@@ -41,18 +39,10 @@ THREE.BasisTextureLoader = function ( manager ) {
 
 };
 
-THREE.BasisTextureLoader.prototype = {
+THREE.BasisTextureLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.BasisTextureLoader,
 
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	setTranscoderPath: function ( path ) {
 
 		this.transcoderPath = path;
@@ -315,7 +305,8 @@ THREE.BasisTextureLoader.prototype = {
 		return this;
 
 	}
-};
+
+} );
 
 /* CONSTANTS */
 

+ 4 - 27
examples/js/loaders/ColladaLoader.js

@@ -5,21 +5,19 @@
 
 THREE.ColladaLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.ColladaLoader.prototype = {
+THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.ColladaLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new THREE.FileLoader( scope.manager );
 		loader.setPath( scope.path );
@@ -31,20 +29,6 @@ THREE.ColladaLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
 	options: {
 
 		set convertUpAxis( value ) {
@@ -55,13 +39,6 @@ THREE.ColladaLoader.prototype = {
 
 	},
 
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( text, path ) {
 
 		function getElementsByTagName( xml, name ) {
@@ -3968,4 +3945,4 @@ THREE.ColladaLoader.prototype = {
 
 	}
 
-};
+} );

+ 4 - 22
examples/js/loaders/DRACOLoader.js

@@ -4,10 +4,7 @@
 
 THREE.DRACOLoader = function ( manager ) {
 
-	this.manager = manager || THREE.DefaultLoadingManager;
-
-	this.path = '';
-	this.crossOrigin = 'anonymous';
+	THREE.Loader.call( this, manager );
 
 	this.decoderPath = '';
 	this.decoderConfig = {};
@@ -34,26 +31,10 @@ THREE.DRACOLoader = function ( manager ) {
 
 };
 
-THREE.DRACOLoader.prototype = {
+THREE.DRACOLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.DRACOLoader,
 
-	setPath: function ( path ) {
-
-		this.path = path;
-
-		return this;
-
-	},
-
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	setDecoderPath: function ( path ) {
 
 		this.decoderPath = path;
@@ -367,7 +348,8 @@ THREE.DRACOLoader.prototype = {
 		return this;
 
 	}
-};
+
+} );
 
 /* WEB WORKER */
 

+ 5 - 28
examples/js/loaders/FBXLoader.js

@@ -27,21 +27,19 @@ THREE.FBXLoader = ( function () {
 
 	function FBXLoader( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+		THREE.Loader.call( this, manager );
 
 	}
 
-	FBXLoader.prototype = {
+	FBXLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 		constructor: FBXLoader,
 
-		crossOrigin: 'anonymous',
-
 		load: function ( url, onLoad, onProgress, onError ) {
 
 			var self = this;
 
-			var path = ( self.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;
+			var path = ( self.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : self.path;
 
 			var loader = new THREE.FileLoader( this.manager );
 			loader.setPath( self.path );
@@ -69,27 +67,6 @@ THREE.FBXLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
-		setResourcePath: function ( value ) {
-
-			this.resourcePath = value;
-			return this;
-
-		},
-
-		setCrossOrigin: function ( value ) {
-
-			this.crossOrigin = value;
-			return this;
-
-		},
-
 		parse: function ( FBXBuffer, path ) {
 
 			if ( isFbxFormatBinary( FBXBuffer ) ) {
@@ -124,7 +101,7 @@ THREE.FBXLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	// Parse the FBXTree object returned by the BinaryParser or TextParser and return a THREE.Group
 	function FBXTreeParser( textureLoader ) {
@@ -4126,4 +4103,4 @@ THREE.FBXLoader = ( function () {
 
 	return FBXLoader;
 
-} )();
+} )();

+ 3 - 10
examples/js/loaders/GCodeLoader.js

@@ -11,13 +11,13 @@
 
 THREE.GCodeLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 	this.splitLayer = false;
 
 };
 
-THREE.GCodeLoader.prototype = {
+THREE.GCodeLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.GCodeLoader,
 
@@ -35,13 +35,6 @@ THREE.GCodeLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		var state = { x: 0, y: 0, z: 0, e: 0, f: 0, extruding: false, relative: false };
@@ -227,4 +220,4 @@ THREE.GCodeLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/KMZLoader.js

@@ -4,11 +4,11 @@
 
 THREE.KMZLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.KMZLoader.prototype = {
+THREE.KMZLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.KMZLoader,
 
@@ -27,13 +27,6 @@ THREE.KMZLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function findFile( url ) {
@@ -109,4 +102,4 @@ THREE.KMZLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/PLYLoader.js

@@ -29,13 +29,13 @@
 
 THREE.PLYLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 	this.propertyNameMapping = {};
 
 };
 
-THREE.PLYLoader.prototype = {
+THREE.PLYLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.PLYLoader,
 
@@ -54,13 +54,6 @@ THREE.PLYLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	setPropertyNameMapping: function ( mapping ) {
 
 		this.propertyNameMapping = mapping;
@@ -502,4 +495,4 @@ THREE.PLYLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/PlayCanvasLoader.js

@@ -5,11 +5,11 @@
 
 THREE.PlayCanvasLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.PlayCanvasLoader.prototype = {
+THREE.PlayCanvasLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.PlayCanvasLoader,
 
@@ -27,13 +27,6 @@ THREE.PlayCanvasLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( json ) {
 
 		function parseVertices( data ) {
@@ -200,4 +193,4 @@ THREE.PlayCanvasLoader.prototype = {
 
 	}
 
-};
+} );

+ 3 - 10
examples/js/loaders/STLLoader.js

@@ -58,11 +58,11 @@
 
 THREE.STLLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
 
 };
 
-THREE.STLLoader.prototype = {
+THREE.STLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.STLLoader,
 
@@ -93,13 +93,6 @@ THREE.STLLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function isBinary( data ) {
@@ -399,4 +392,4 @@ THREE.STLLoader.prototype = {
 
 	}
 
-};
+} );

+ 6 - 52
examples/js/loaders/TDSLoader.js

@@ -11,7 +11,8 @@
 
 THREE.TDSLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+	THREE.Loader.call( this, manager );
+
 	this.debug = false;
 
 	this.group = null;
@@ -22,12 +23,10 @@ THREE.TDSLoader = function ( manager ) {
 
 };
 
-THREE.TDSLoader.prototype = {
+THREE.TDSLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 	constructor: THREE.TDSLoader,
 
-	crossOrigin: 'anonymous',
-
 	/**
 	 * Load 3ds file from url.
 	 *
@@ -41,7 +40,7 @@ THREE.TDSLoader.prototype = {
 
 		var scope = this;
 
-		var path = this.path !== undefined ? this.path : THREE.LoaderUtils.extractUrlBase( url );
+		var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new THREE.FileLoader( this.manager );
 		loader.setPath( this.path );
@@ -845,52 +844,6 @@ THREE.TDSLoader.prototype = {
 
 	},
 
-	/**
-	 * Set path to adjust the path to the original 3ds file.
-	 *
-	 * @method setPath
-	 * @param {String} path Path to file.
-	 * @return Self for chaining.
-	 */
-	setPath: function ( path ) {
-
-		this.path = path;
-
-		return this;
-
-	},
-
-	/**
-	 * Set resource path used to determine the path to attached resources like textures.
-	 *
-	 * @method setResourcePath
-	 * @param {String} resourcePath Path to resources.
-	 * @return Self for chaining.
-	 */
-	setResourcePath: function ( resourcePath ) {
-
-		this.resourcePath = resourcePath;
-
-		return this;
-
-	},
-
-	/**
-	 * Set crossOrigin value to configure CORS settings
-	 * for the image loading process.
-	 *
-	 * @method setCrossOrigin
-	 * @param {String} crossOrigin crossOrigin string.
-	 * @return Self for chaining.
-	 */
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	/**
 	 * Print debug message to the console.
 	 *
@@ -908,7 +861,8 @@ THREE.TDSLoader.prototype = {
 		}
 
 	}
-};
+
+} );
 
 // var NULL_CHUNK = 0x0000;
 var M3DMAGIC = 0x4D4D;

+ 4 - 27
examples/js/loaders/VRMLLoader.js

@@ -18,21 +18,19 @@ THREE.VRMLLoader = ( function () {
 
 	function VRMLLoader( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+		THREE.Loader.call( this, manager );
 
 	}
 
-	VRMLLoader.prototype = {
+	VRMLLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype ), {
 
 		constructor: VRMLLoader,
 
-		crossOrigin: 'anonymous',
-
 		load: function ( url, onLoad, onProgress, onError ) {
 
 			var scope = this;
 
-			var path = ( scope.path === undefined ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
+			var path = ( scope.path === '' ) ? THREE.LoaderUtils.extractUrlBase( url ) : scope.path;
 
 			var loader = new THREE.FileLoader( this.manager );
 			loader.setPath( scope.path );
@@ -44,27 +42,6 @@ THREE.VRMLLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
-		setResourcePath: function ( value ) {
-
-			this.resourcePath = value;
-			return this;
-
-		},
-
-		setCrossOrigin: function ( value ) {
-
-			this.crossOrigin = value;
-			return this;
-
-		},
-
 		parse: function ( data, path ) {
 
 			var nodeMap = {};
@@ -2353,7 +2330,7 @@ THREE.VRMLLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	function VRMLLexer( tokens ) {
 

+ 2 - 4
examples/jsm/loaders/3MFLoader.d.ts

@@ -1,16 +1,14 @@
 import {
+  Loader,
   LoadingManager,
   Group
 } from '../../../src/Three';
 
-export class ThreeMFLoader {
+export class ThreeMFLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
   availableExtensions: object[];
 
   load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setPath(value: string): this;
   parse(data: ArrayBuffer): Group;
   addExtension(extension: object):void
 }

+ 5 - 11
examples/jsm/loaders/3MFLoader.js

@@ -17,9 +17,9 @@
 import {
 	BufferAttribute,
 	BufferGeometry,
-	DefaultLoadingManager,
 	FileLoader,
 	Group,
+	Loader,
 	LoaderUtils,
 	Matrix4,
 	Mesh,
@@ -28,12 +28,13 @@ import {
 
 var ThreeMFLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
+
 	this.availableExtensions = [];
 
 };
 
-ThreeMFLoader.prototype = {
+ThreeMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: ThreeMFLoader,
 
@@ -51,13 +52,6 @@ ThreeMFLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		var scope = this;
@@ -938,6 +932,6 @@ ThreeMFLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { ThreeMFLoader };

+ 2 - 4
examples/jsm/loaders/AMFLoader.d.ts

@@ -1,14 +1,12 @@
 import {
+  Loader,
   LoadingManager,
   Group
 } from '../../../src/Three';
 
-export class AMFLoader {
+export class AMFLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
 
   load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setPath(value: string): this;
   parse(data: ArrayBuffer): Group;
 }

+ 4 - 11
examples/jsm/loaders/AMFLoader.js

@@ -21,10 +21,10 @@
 import {
 	BufferGeometry,
 	Color,
-	DefaultLoadingManager,
 	FileLoader,
 	Float32BufferAttribute,
 	Group,
+	Loader,
 	LoaderUtils,
 	Mesh,
 	MeshPhongMaterial
@@ -32,11 +32,11 @@ import {
 
 var AMFLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-AMFLoader.prototype = {
+AMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: AMFLoader,
 
@@ -55,13 +55,6 @@ AMFLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function loadDocument( data ) {
@@ -504,6 +497,6 @@ AMFLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { AMFLoader };

+ 2 - 3
examples/jsm/loaders/AWDLoader.d.ts

@@ -1,6 +1,7 @@
 import {
   Bone,
   BufferGeometry,
+  Loader,
   LoadingManager,
   Material,
   Matrix4,
@@ -9,9 +10,8 @@ import {
   Texture
 } from '../../../src/Three';
 
-export class AWDLoader {
+export class AWDLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
   materialFactory: any;
   path: string;
   trunk: Object3D;
@@ -19,7 +19,6 @@ export class AWDLoader {
   getBlock(id: number): any;
   load(url: string, onLoad: (result: Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
   loadTexture(url: string): Texture;
-  setPath(path: string): this;
   parse(data: ArrayBuffer): Object3D;
   parseAnimatorSet(): object;
   parseAttrValue(type: number, value: number): any;

+ 4 - 11
examples/jsm/loaders/AWDLoader.js

@@ -7,9 +7,9 @@ import {
 	Bone,
 	BufferAttribute,
 	BufferGeometry,
-	DefaultLoadingManager,
 	FileLoader,
 	ImageLoader,
+	Loader,
 	Matrix4,
 	Mesh,
 	MeshPhongMaterial,
@@ -94,7 +94,7 @@ var AWDLoader = ( function () {
 
 	var AWDLoader = function ( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+		Loader.call( this, manager );
 
 		this.trunk = new Object3D();
 
@@ -120,7 +120,7 @@ var AWDLoader = ( function () {
 
 	};
 
-	AWDLoader.prototype = {
+	AWDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		constructor: AWDLoader,
 
@@ -142,13 +142,6 @@ var AWDLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
 		parse: function ( data ) {
 
 			var blen = data.byteLength;
@@ -1233,7 +1226,7 @@ var AWDLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	return AWDLoader;
 

+ 2 - 8
examples/jsm/loaders/AssimpJSONLoader.d.ts

@@ -1,18 +1,12 @@
 import {
   Object3D,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
-export class AssimpJSONLoader {
+export class AssimpJSONLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  crossOrigin: string;
-  path: string;
-  resourcePath: string;
 
   load(url: string, onLoad: (object: Object3D) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-  setResourcePath(path: string) : this;
-  setCrossOrigin(value: string): this;
   parse(json: object, path: string) : Object3D;
 }

+ 5 - 28
examples/jsm/loaders/AssimpJSONLoader.js

@@ -13,9 +13,9 @@
 
 import {
 	BufferGeometry,
-	DefaultLoadingManager,
 	FileLoader,
 	Float32BufferAttribute,
+	Loader,
 	LoaderUtils,
 	Matrix4,
 	Mesh,
@@ -27,21 +27,19 @@ import {
 
 var AssimpJSONLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-AssimpJSONLoader.prototype = {
+AssimpJSONLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: AssimpJSONLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new FileLoader( this.manager );
 		loader.setPath( scope.path );
@@ -79,27 +77,6 @@ AssimpJSONLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( json, path ) {
 
 		function parseList( json, handler ) {
@@ -304,6 +281,6 @@ AssimpJSONLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { AssimpJSONLoader };

+ 2 - 8
examples/jsm/loaders/AssimpLoader.d.ts

@@ -1,5 +1,6 @@
 import {
   Object3D,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
@@ -9,16 +10,9 @@ export interface Assimp {
   object: Object3D;
 }
 
-export class AssimpLoader {
+export class AssimpLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  crossOrigin: string;
-  path: string;
-  resourcePath: string;
 
   load(url: string, onLoad: (result: Assimp) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-  setResourcePath(path: string) : this;
-  setCrossOrigin(value: string): this;
   parse(buffer: ArrayBuffer, path: string) : Assimp;
 }

+ 5 - 28
examples/jsm/loaders/AssimpLoader.js

@@ -7,8 +7,8 @@ import {
 	BufferAttribute,
 	BufferGeometry,
 	Color,
-	DefaultLoadingManager,
 	FileLoader,
+	Loader,
 	LoaderUtils,
 	Matrix4,
 	Mesh,
@@ -24,21 +24,19 @@ import {
 
 var AssimpLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-AssimpLoader.prototype = {
+AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: AssimpLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new FileLoader( this.manager );
 		loader.setPath( scope.path );
@@ -52,27 +50,6 @@ AssimpLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( buffer, path ) {
 
 		var textureLoader = new TextureLoader( this.manager );
@@ -2294,6 +2271,6 @@ AssimpLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { AssimpLoader };

+ 2 - 5
examples/jsm/loaders/BVHLoader.d.ts

@@ -1,6 +1,7 @@
 import {
   AnimationClip,
   Skeleton,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
@@ -10,15 +11,11 @@ export interface BVH {
   skeleton: Skeleton;
 }
 
-export class BVHLoader {
+export class BVHLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
   animateBonePositions: boolean;
   animateBoneRotations: boolean;
 
   load(url: string, onLoad: (bvh: BVH) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-
   parse(text: string) : BVH;
 }

+ 4 - 11
examples/jsm/loaders/BVHLoader.js

@@ -11,8 +11,8 @@
 import {
 	AnimationClip,
 	Bone,
-	DefaultLoadingManager,
 	FileLoader,
+	Loader,
 	Quaternion,
 	QuaternionKeyframeTrack,
 	Skeleton,
@@ -22,14 +22,14 @@ import {
 
 var BVHLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 	this.animateBonePositions = true;
 	this.animateBoneRotations = true;
 
 };
 
-BVHLoader.prototype = {
+BVHLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: BVHLoader,
 
@@ -47,13 +47,6 @@ BVHLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( text ) {
 
 		/*
@@ -423,6 +416,6 @@ BVHLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { BVHLoader };

+ 2 - 4
examples/jsm/loaders/BabylonLoader.d.ts

@@ -1,14 +1,12 @@
 import {
+  Loader,
   LoadingManager,
   Scene
 } from '../../../src/Three';
 
-export class BabylonLoader {
+export class BabylonLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
 
   load(url: string, onLoad: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
   parse(json: object): Scene;
-  setPath(value: string): this;
 }

+ 4 - 11
examples/jsm/loaders/BabylonLoader.js

@@ -5,12 +5,12 @@
 
 import {
 	BufferGeometry,
-	DefaultLoadingManager,
 	DirectionalLight,
 	FileLoader,
 	Float32BufferAttribute,
 	Group,
 	HemisphereLight,
+	Loader,
 	Mesh,
 	MeshPhongMaterial,
 	PerspectiveCamera,
@@ -21,11 +21,11 @@ import {
 
 var BabylonLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-BabylonLoader.prototype = {
+BabylonLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: BabylonLoader,
 
@@ -43,13 +43,6 @@ BabylonLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( json ) {
 
 		function parseMaterials( json ) {
@@ -268,6 +261,6 @@ BabylonLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { BabylonLoader };

+ 2 - 4
examples/jsm/loaders/BasisTextureLoader.d.ts

@@ -1,13 +1,12 @@
 import {
   CompressedTexture,
+  Loader,
   LoadingManager,
   WebGLRenderer
 } from '../../../src/Three';
 
-export class BasisTextureLoader {
+export class BasisTextureLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  crossOrigin: string;
   transcoderBinary: ArrayBuffer | null;
   transcoderPath: string;
   transcoderPending: Promise<void> | null;
@@ -26,7 +25,6 @@ export class BasisTextureLoader {
   detectSupport(renderer: WebGLRenderer): this;
   dispose(): void;
   load(url: string, onLoad: (texture: CompressedTexture) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setCrossOrigin(crossOrigin: string): this;
   setTranscoderPath(path: string): this;
   setWorkerLimit(workerLimit: number): this;
 }

+ 5 - 14
examples/jsm/loaders/BasisTextureLoader.js

@@ -6,10 +6,10 @@
 
 import {
 	CompressedTexture,
-	DefaultLoadingManager,
 	FileLoader,
 	LinearFilter,
 	LinearMipmapLinearFilter,
+	Loader,
 	RGB_ETC1_Format,
 	RGB_PVRTC_4BPPV1_Format,
 	UnsignedByteType
@@ -31,9 +31,7 @@ import {
  */
 var BasisTextureLoader = function ( manager ) {
 
-	this.manager = manager || DefaultLoadingManager;
-
-	this.crossOrigin = 'anonymous';
+	Loader.call( this, manager );
 
 	this.transcoderPath = '';
 	this.transcoderBinary = null;
@@ -52,18 +50,10 @@ var BasisTextureLoader = function ( manager ) {
 
 };
 
-BasisTextureLoader.prototype = {
+BasisTextureLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: BasisTextureLoader,
 
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	setTranscoderPath: function ( path ) {
 
 		this.transcoderPath = path;
@@ -326,7 +316,8 @@ BasisTextureLoader.prototype = {
 		return this;
 
 	}
-};
+
+} );
 
 /* CONSTANTS */
 

+ 2 - 9
examples/jsm/loaders/ColladaLoader.d.ts

@@ -1,5 +1,6 @@
 import {
   AnimationClip,
+  Loader,
   LoadingManager,
   Scene
 } from '../../../src/Three';
@@ -12,17 +13,9 @@ export interface Collada {
   scene: Scene;
 }
 
-export class ColladaLoader {
+export class ColladaLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  crossOrigin: string;
-  path: string;
-  resourcePath: string;
 
   load(url: string, onLoad: (collada: Collada) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-  setResourcePath(path: string) : this;
-  setCrossOrigin(value: string): this;
-
   parse(text: string, path: string) : Collada;
 }

+ 5 - 28
examples/jsm/loaders/ColladaLoader.js

@@ -10,7 +10,6 @@ import {
 	BufferGeometry,
 	ClampToEdgeWrapping,
 	Color,
-	DefaultLoadingManager,
 	DirectionalLight,
 	DoubleSide,
 	Euler,
@@ -20,6 +19,7 @@ import {
 	Line,
 	LineBasicMaterial,
 	LineSegments,
+	Loader,
 	LoaderUtils,
 	Math as _Math,
 	Matrix4,
@@ -45,21 +45,19 @@ import { TGALoader } from "../loaders/TGALoader.js";
 
 var ColladaLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-ColladaLoader.prototype = {
+ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: ColladaLoader,
 
-	crossOrigin: 'anonymous',
-
 	load: function ( url, onLoad, onProgress, onError ) {
 
 		var scope = this;
 
-		var path = ( scope.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
+		var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
 
 		var loader = new FileLoader( scope.manager );
 		loader.setPath( scope.path );
@@ -71,20 +69,6 @@ ColladaLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
-	setResourcePath: function ( value ) {
-
-		this.resourcePath = value;
-		return this;
-
-	},
-
 	options: {
 
 		set convertUpAxis( value ) {
@@ -95,13 +79,6 @@ ColladaLoader.prototype = {
 
 	},
 
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-		return this;
-
-	},
-
 	parse: function ( text, path ) {
 
 		function getElementsByTagName( xml, name ) {
@@ -4008,6 +3985,6 @@ ColladaLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { ColladaLoader };

+ 2 - 3
examples/jsm/loaders/DRACOLoader.d.ts

@@ -1,16 +1,15 @@
 import {
+  Loader,
   LoadingManager,
   BufferGeometry
 } from '../../../src/Three';
 
-export class DRACOLoader {
+export class DRACOLoader extends Loader {
   constructor(manager?: LoadingManager);
 
   load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setPath(path: string): DRACOLoader;
   setDecoderPath(path: string): DRACOLoader;
   setDecoderConfig(config: object): DRACOLoader;
-  setCrossOrigin(crossOrigin: string): DRACOLoader;
   setWorkerLimit(workerLimit: number): DRACOLoader;
   dispose(): DRACOLoader;
 }

+ 6 - 24
examples/jsm/loaders/DRACOLoader.js

@@ -5,16 +5,13 @@
 import {
 	BufferAttribute,
 	BufferGeometry,
-	DefaultLoadingManager,
-	FileLoader
+	FileLoader,
+	Loader
 } from "../../../build/three.module.js";
 
 var DRACOLoader = function ( manager ) {
 
-	this.manager = manager || DefaultLoadingManager;
-
-	this.path = '';
-	this.crossOrigin = 'anonymous';
+	Loader.call( this, manager );
 
 	this.decoderPath = '';
 	this.decoderConfig = {};
@@ -41,26 +38,10 @@ var DRACOLoader = function ( manager ) {
 
 };
 
-DRACOLoader.prototype = {
+DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: DRACOLoader,
 
-	setPath: function ( path ) {
-
-		this.path = path;
-
-		return this;
-
-	},
-
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	setDecoderPath: function ( path ) {
 
 		this.decoderPath = path;
@@ -374,7 +355,8 @@ DRACOLoader.prototype = {
 		return this;
 
 	}
-};
+
+} );
 
 /* WEB WORKER */
 

+ 2 - 9
examples/jsm/loaders/FBXLoader.d.ts

@@ -1,19 +1,12 @@
 import {
   Group,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
-export class FBXLoader {
+export class FBXLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  crossOrigin: string;
-  path: string;
-  resourcePath: string;
 
   load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-  setResourcePath(path: string) : this;
-  setCrossOrigin(value: string): this;
-
   parse(FBXBuffer: ArrayBuffer | string, path: string) : Group;
 }

+ 5 - 28
examples/jsm/loaders/FBXLoader.js

@@ -26,7 +26,6 @@ import {
 	BufferGeometry,
 	ClampToEdgeWrapping,
 	Color,
-	DefaultLoadingManager,
 	DirectionalLight,
 	EquirectangularReflectionMapping,
 	Euler,
@@ -76,21 +75,19 @@ var FBXLoader = ( function () {
 
 	function FBXLoader( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+		Loader.call( this, manager );
 
 	}
 
-	FBXLoader.prototype = {
+	FBXLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		constructor: FBXLoader,
 
-		crossOrigin: 'anonymous',
-
 		load: function ( url, onLoad, onProgress, onError ) {
 
 			var self = this;
 
-			var path = ( self.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : self.path;
+			var path = ( self.path === '' ) ? LoaderUtils.extractUrlBase( url ) : self.path;
 
 			var loader = new FileLoader( this.manager );
 			loader.setPath( self.path );
@@ -118,27 +115,6 @@ var FBXLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
-		setResourcePath: function ( value ) {
-
-			this.resourcePath = value;
-			return this;
-
-		},
-
-		setCrossOrigin: function ( value ) {
-
-			this.crossOrigin = value;
-			return this;
-
-		},
-
 		parse: function ( FBXBuffer, path ) {
 
 			if ( isFbxFormatBinary( FBXBuffer ) ) {
@@ -173,7 +149,7 @@ var FBXLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	// Parse the FBXTree object returned by the BinaryParser or TextParser and return a Group
 	function FBXTreeParser( textureLoader ) {
@@ -4176,4 +4152,5 @@ var FBXLoader = ( function () {
 	return FBXLoader;
 
 } )();
+
 export { FBXLoader };

+ 2 - 5
examples/jsm/loaders/GCodeLoader.d.ts

@@ -1,16 +1,13 @@
 import {
   Group,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
-export class GCodeLoader {
+export class GCodeLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
   splitLayer: boolean;
 
   load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-
   parse(data: string) : Group;
 }

+ 5 - 12
examples/jsm/loaders/GCodeLoader.js

@@ -11,24 +11,24 @@
 
 import {
 	BufferGeometry,
-	DefaultLoadingManager,
 	Euler,
 	FileLoader,
 	Float32BufferAttribute,
 	Group,
 	LineBasicMaterial,
-	LineSegments
+	LineSegments,
+	Loader
 } from "../../../build/three.module.js";
 
 var GCodeLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 	this.splitLayer = false;
 
 };
 
-GCodeLoader.prototype = {
+GCodeLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: GCodeLoader,
 
@@ -46,13 +46,6 @@ GCodeLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		var state = { x: 0, y: 0, z: 0, e: 0, f: 0, extruding: false, relative: false };
@@ -238,6 +231,6 @@ GCodeLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { GCodeLoader };

+ 2 - 4
examples/jsm/loaders/KMZLoader.d.ts

@@ -1,15 +1,13 @@
 import {
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
 import { Collada } from './ColladaLoader';
 
-export class KMZLoader {
+export class KMZLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
 
   load(url: string, onLoad: (kmz: Collada) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setPath(value: string): this;
   parse(data: ArrayBuffer): Collada;
 }

+ 4 - 11
examples/jsm/loaders/KMZLoader.js

@@ -3,20 +3,20 @@
  */
 
 import {
-	DefaultLoadingManager,
 	FileLoader,
 	Group,
+	Loader,
 	LoadingManager
 } from "../../../build/three.module.js";
 import { ColladaLoader } from "../loaders/ColladaLoader.js";
 
 var KMZLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-KMZLoader.prototype = {
+KMZLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: KMZLoader,
 
@@ -35,13 +35,6 @@ KMZLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function findFile( url ) {
@@ -117,6 +110,6 @@ KMZLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { KMZLoader };

+ 2 - 5
examples/jsm/loaders/PLYLoader.d.ts

@@ -1,18 +1,15 @@
 import {
   BufferGeometry,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
 
-export class PLYLoader {
+export class PLYLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
   propertyNameMapping: object;
-  path: string;
 
   load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
   setPropertyNameMapping(mapping: object) : void;
-
   parse(data: ArrayBuffer | string) : BufferGeometry;
 }

+ 4 - 11
examples/jsm/loaders/PLYLoader.js

@@ -28,22 +28,22 @@
 
 import {
 	BufferGeometry,
-	DefaultLoadingManager,
 	FileLoader,
 	Float32BufferAttribute,
+	Loader,
 	LoaderUtils
 } from "../../../build/three.module.js";
 
 
 var PLYLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 	this.propertyNameMapping = {};
 
 };
 
-PLYLoader.prototype = {
+PLYLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: PLYLoader,
 
@@ -62,13 +62,6 @@ PLYLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	setPropertyNameMapping: function ( mapping ) {
 
 		this.propertyNameMapping = mapping;
@@ -510,6 +503,6 @@ PLYLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { PLYLoader };

+ 2 - 4
examples/jsm/loaders/PlayCanvasLoader.d.ts

@@ -1,14 +1,12 @@
 import {
+  Loader,
   LoadingManager,
   Group
 } from '../../../src/Three';
 
-export class PlayCanvasLoader {
+export class PlayCanvasLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
 
   load(url: string, onLoad: (group: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
   parse(json: object): Group;
-  setPath(value: string): this;
 }

+ 4 - 11
examples/jsm/loaders/PlayCanvasLoader.js

@@ -5,11 +5,11 @@
 
 import {
 	BufferGeometry,
-	DefaultLoadingManager,
 	Euler,
 	FileLoader,
 	Float32BufferAttribute,
 	Group,
+	Loader,
 	Mesh,
 	MeshPhongMaterial,
 	Uint16BufferAttribute,
@@ -18,11 +18,11 @@ import {
 
 var PlayCanvasLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-PlayCanvasLoader.prototype = {
+PlayCanvasLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: PlayCanvasLoader,
 
@@ -40,13 +40,6 @@ PlayCanvasLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( json ) {
 
 		function parseVertices( data ) {
@@ -213,6 +206,6 @@ PlayCanvasLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { PlayCanvasLoader };

+ 2 - 5
examples/jsm/loaders/STLLoader.d.ts

@@ -1,16 +1,13 @@
 import {
   BufferGeometry,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
 
-export class STLLoader {
+export class STLLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
 
   load(url: string, onLoad: (geometry: BufferGeometry) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-
   parse(data: ArrayBuffer | string) : BufferGeometry;
 }

+ 4 - 11
examples/jsm/loaders/STLLoader.js

@@ -58,9 +58,9 @@
 import {
 	BufferAttribute,
 	BufferGeometry,
-	DefaultLoadingManager,
 	FileLoader,
 	Float32BufferAttribute,
+	Loader,
 	LoaderUtils,
 	Vector3
 } from "../../../build/three.module.js";
@@ -68,11 +68,11 @@ import {
 
 var STLLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
 
 };
 
-STLLoader.prototype = {
+STLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: STLLoader,
 
@@ -103,13 +103,6 @@ STLLoader.prototype = {
 
 	},
 
-	setPath: function ( value ) {
-
-		this.path = value;
-		return this;
-
-	},
-
 	parse: function ( data ) {
 
 		function isBinary( data ) {
@@ -409,6 +402,6 @@ STLLoader.prototype = {
 
 	}
 
-};
+} );
 
 export { STLLoader };

+ 2 - 7
examples/jsm/loaders/TDSLoader.d.ts

@@ -1,28 +1,23 @@
 import {
   Color,
   Group,
+  Loader,
   LoadingManager,
   Material,
   Mesh,
   Texture
 } from '../../../src/Three';
 
-export class TDSLoader {
+export class TDSLoader extends Loader {
   constructor(manager?: LoadingManager);
-  crossOrigin: string;
   debug: boolean;
   group: Group;
   manager: LoadingManager;
   materials: Material[];
   meshes: Mesh[];
-  path: string;
   position: number;
-  resourcePath: string;
 
   load(url: string, onLoad: (object: Group) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void): void;
-  setPath(path: string): this;
-  setResourcePath(path: string): this;
-  setCrossOrigin(path: string): this;
   parse(arraybuffer: ArrayBuffer, path: string): Group;
 
   debugMessage(message: object): void;

+ 6 - 52
examples/jsm/loaders/TDSLoader.js

@@ -13,11 +13,11 @@ import {
 	AdditiveBlending,
 	BufferGeometry,
 	Color,
-	DefaultLoadingManager,
 	DoubleSide,
 	FileLoader,
 	Float32BufferAttribute,
 	Group,
+	Loader,
 	LoaderUtils,
 	Matrix4,
 	Mesh,
@@ -27,7 +27,8 @@ import {
 
 var TDSLoader = function ( manager ) {
 
-	this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+	Loader.call( this, manager );
+
 	this.debug = false;
 
 	this.group = null;
@@ -38,12 +39,10 @@ var TDSLoader = function ( manager ) {
 
 };
 
-TDSLoader.prototype = {
+TDSLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	constructor: TDSLoader,
 
-	crossOrigin: 'anonymous',
-
 	/**
 	 * Load 3ds file from url.
 	 *
@@ -861,52 +860,6 @@ TDSLoader.prototype = {
 
 	},
 
-	/**
-	 * Set path to adjust the path to the original 3ds file.
-	 *
-	 * @method setPath
-	 * @param {String} path Path to file.
-	 * @return Self for chaining.
-	 */
-	setPath: function ( path ) {
-
-		this.path = path;
-
-		return this;
-
-	},
-
-	/**
-	 * Set resource path used to determine the path to attached resources like textures.
-	 *
-	 * @method setResourcePath
-	 * @param {String} resourcePath Path to resources.
-	 * @return Self for chaining.
-	 */
-	setResourcePath: function ( resourcePath ) {
-
-		this.resourcePath = resourcePath;
-
-		return this;
-
-	},
-
-	/**
-	 * Set crossOrigin value to configure CORS settings
-	 * for the image loading process.
-	 *
-	 * @method setCrossOrigin
-	 * @param {String} crossOrigin crossOrigin string.
-	 * @return Self for chaining.
-	 */
-	setCrossOrigin: function ( crossOrigin ) {
-
-		this.crossOrigin = crossOrigin;
-
-		return this;
-
-	},
-
 	/**
 	 * Print debug message to the console.
 	 *
@@ -924,7 +877,8 @@ TDSLoader.prototype = {
 		}
 
 	}
-};
+
+} );
 
 // var NULL_CHUNK = 0x0000;
 var M3DMAGIC = 0x4D4D;

+ 2 - 9
examples/jsm/loaders/VRMLLoader.d.ts

@@ -1,19 +1,12 @@
 import {
   Scene,
+  Loader,
   LoadingManager
 } from '../../../src/Three';
 
-export class VRMLLoader {
+export class VRMLLoader extends Loader {
   constructor(manager?: LoadingManager);
-  manager: LoadingManager;
-  path: string;
-  resourcePath: string;
-  crossOrigin: string;
 
   load(url: string, onLoad: (scene: Scene) => void, onProgress?: (event: ProgressEvent) => void, onError?: (event: ErrorEvent) => void) : void;
-  setPath(path: string) : this;
-  setResourcePath(path: string) : this;
-  setCrossOrigin(path: string) : this;
-
   parse(data: string, path: string) : Scene;
 }

+ 5 - 28
examples/jsm/loaders/VRMLLoader.js

@@ -11,7 +11,6 @@ import {
 	Color,
 	ConeBufferGeometry,
 	CylinderBufferGeometry,
-	DefaultLoadingManager,
 	DoubleSide,
 	FileLoader,
 	Float32BufferAttribute,
@@ -19,6 +18,7 @@ import {
 	Group,
 	LineBasicMaterial,
 	LineSegments,
+	Loader,
 	LoaderUtils,
 	Mesh,
 	MeshBasicMaterial,
@@ -52,21 +52,19 @@ var VRMLLoader = ( function () {
 
 	function VRMLLoader( manager ) {
 
-		this.manager = ( manager !== undefined ) ? manager : DefaultLoadingManager;
+		Loader.call( this, manager );
 
 	}
 
-	VRMLLoader.prototype = {
+	VRMLLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		constructor: VRMLLoader,
 
-		crossOrigin: 'anonymous',
-
 		load: function ( url, onLoad, onProgress, onError ) {
 
 			var scope = this;
 
-			var path = ( scope.path === undefined ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
+			var path = ( scope.path === '' ) ? LoaderUtils.extractUrlBase( url ) : scope.path;
 
 			var loader = new FileLoader( this.manager );
 			loader.setPath( scope.path );
@@ -78,27 +76,6 @@ var VRMLLoader = ( function () {
 
 		},
 
-		setPath: function ( value ) {
-
-			this.path = value;
-			return this;
-
-		},
-
-		setResourcePath: function ( value ) {
-
-			this.resourcePath = value;
-			return this;
-
-		},
-
-		setCrossOrigin: function ( value ) {
-
-			this.crossOrigin = value;
-			return this;
-
-		},
-
 		parse: function ( data, path ) {
 
 			var nodeMap = {};
@@ -2387,7 +2364,7 @@ var VRMLLoader = ( function () {
 
 		}
 
-	};
+	} );
 
 	function VRMLLexer( tokens ) {