Explorar o código

Merge pull request #20100 from linbingquan/dev-es6-materials

materials: Convert to es6.
Mr.doob %!s(int64=4) %!d(string=hai) anos
pai
achega
60ccc81b23

+ 23 - 22
src/materials/LineBasicMaterial.js

@@ -12,44 +12,45 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function LineBasicMaterial( parameters ) {
+class LineBasicMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'LineBasicMaterial';
+		super();
 
-	this.color = new Color( 0xffffff );
+		this.type = 'LineBasicMaterial';
 
-	this.linewidth = 1;
-	this.linecap = 'round';
-	this.linejoin = 'round';
+		this.color = new Color( 0xffffff );
 
-	this.morphTargets = false;
+		this.linewidth = 1;
+		this.linecap = 'round';
+		this.linejoin = 'round';
 
-	this.setValues( parameters );
+		this.morphTargets = false;
 
-}
+		this.setValues( parameters );
 
-LineBasicMaterial.prototype = Object.create( Material.prototype );
-LineBasicMaterial.prototype.constructor = LineBasicMaterial;
+	}
 
-LineBasicMaterial.prototype.isLineBasicMaterial = true;
 
-LineBasicMaterial.prototype.copy = function ( source ) {
+	copy( source ) {
 
-	Material.prototype.copy.call( this, source );
+		super.copy( source );
 
-	this.color.copy( source.color );
+		this.color.copy( source.color );
 
-	this.linewidth = source.linewidth;
-	this.linecap = source.linecap;
-	this.linejoin = source.linejoin;
+		this.linewidth = source.linewidth;
+		this.linecap = source.linecap;
+		this.linejoin = source.linejoin;
 
-	this.morphTargets = source.morphTargets;
+		this.morphTargets = source.morphTargets;
 
-	return this;
+		return this;
 
-};
+	}
 
+}
+
+LineBasicMaterial.prototype.isLineBasicMaterial = true;
 
 export { LineBasicMaterial };

+ 18 - 18
src/materials/LineDashedMaterial.js

@@ -13,36 +13,36 @@ import { LineBasicMaterial } from './LineBasicMaterial.js';
  * }
  */
 
-function LineDashedMaterial( parameters ) {
+class LineDashedMaterial extends LineBasicMaterial {
 
-	LineBasicMaterial.call( this );
+	constructor( parameters ) {
 
-	this.type = 'LineDashedMaterial';
+		super();
 
-	this.scale = 1;
-	this.dashSize = 3;
-	this.gapSize = 1;
+		this.type = 'LineDashedMaterial';
 
-	this.setValues( parameters );
+		this.scale = 1;
+		this.dashSize = 3;
+		this.gapSize = 1;
 
-}
+		this.setValues( parameters );
 
-LineDashedMaterial.prototype = Object.create( LineBasicMaterial.prototype );
-LineDashedMaterial.prototype.constructor = LineDashedMaterial;
+	}
 
-LineDashedMaterial.prototype.isLineDashedMaterial = true;
+	copy( source ) {
 
-LineDashedMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	LineBasicMaterial.prototype.copy.call( this, source );
+		this.scale = source.scale;
+		this.dashSize = source.dashSize;
+		this.gapSize = source.gapSize;
 
-	this.scale = source.scale;
-	this.dashSize = source.dashSize;
-	this.gapSize = source.gapSize;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+LineDashedMaterial.prototype.isLineDashedMaterial = true;
 
 export { LineDashedMaterial };

+ 48 - 48
src/materials/MeshBasicMaterial.js

@@ -34,82 +34,82 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshBasicMaterial( parameters ) {
+class MeshBasicMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshBasicMaterial';
+		super();
 
-	this.color = new Color( 0xffffff ); // emissive
+		this.type = 'MeshBasicMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff ); // emissive
 
-	this.lightMap = null;
-	this.lightMapIntensity = 1.0;
+		this.map = null;
 
-	this.aoMap = null;
-	this.aoMapIntensity = 1.0;
+		this.lightMap = null;
+		this.lightMapIntensity = 1.0;
 
-	this.specularMap = null;
+		this.aoMap = null;
+		this.aoMapIntensity = 1.0;
 
-	this.alphaMap = null;
+		this.specularMap = null;
 
-	this.envMap = null;
-	this.combine = MultiplyOperation;
-	this.reflectivity = 1;
-	this.refractionRatio = 0.98;
+		this.alphaMap = null;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
-	this.wireframeLinecap = 'round';
-	this.wireframeLinejoin = 'round';
+		this.envMap = null;
+		this.combine = MultiplyOperation;
+		this.reflectivity = 1;
+		this.refractionRatio = 0.98;
 
-	this.skinning = false;
-	this.morphTargets = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
+		this.wireframeLinecap = 'round';
+		this.wireframeLinejoin = 'round';
 
-	this.setValues( parameters );
+		this.skinning = false;
+		this.morphTargets = false;
 
-}
+		this.setValues( parameters );
 
-MeshBasicMaterial.prototype = Object.create( Material.prototype );
-MeshBasicMaterial.prototype.constructor = MeshBasicMaterial;
+	}
 
-MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
+	copy( source ) {
 
-MeshBasicMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
 
-	this.color.copy( source.color );
+		this.map = source.map;
 
-	this.map = source.map;
+		this.lightMap = source.lightMap;
+		this.lightMapIntensity = source.lightMapIntensity;
 
-	this.lightMap = source.lightMap;
-	this.lightMapIntensity = source.lightMapIntensity;
+		this.aoMap = source.aoMap;
+		this.aoMapIntensity = source.aoMapIntensity;
 
-	this.aoMap = source.aoMap;
-	this.aoMapIntensity = source.aoMapIntensity;
+		this.specularMap = source.specularMap;
 
-	this.specularMap = source.specularMap;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.envMap = source.envMap;
+		this.combine = source.combine;
+		this.reflectivity = source.reflectivity;
+		this.refractionRatio = source.refractionRatio;
 
-	this.envMap = source.envMap;
-	this.combine = source.combine;
-	this.reflectivity = source.reflectivity;
-	this.refractionRatio = source.refractionRatio;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
+		this.wireframeLinecap = source.wireframeLinecap;
+		this.wireframeLinejoin = source.wireframeLinejoin;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
-	this.wireframeLinecap = source.wireframeLinecap;
-	this.wireframeLinejoin = source.wireframeLinejoin;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshBasicMaterial.prototype.isMeshBasicMaterial = true;
 
 export { MeshBasicMaterial };

+ 33 - 33
src/materials/MeshDepthMaterial.js

@@ -19,62 +19,62 @@ import { BasicDepthPacking } from '../constants.js';
  * }
  */
 
-function MeshDepthMaterial( parameters ) {
+class MeshDepthMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshDepthMaterial';
+		super();
 
-	this.depthPacking = BasicDepthPacking;
+		this.type = 'MeshDepthMaterial';
 
-	this.skinning = false;
-	this.morphTargets = false;
+		this.depthPacking = BasicDepthPacking;
 
-	this.map = null;
+		this.skinning = false;
+		this.morphTargets = false;
 
-	this.alphaMap = null;
+		this.map = null;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.alphaMap = null;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.fog = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
 
-	this.setValues( parameters );
+		this.fog = false;
 
-}
+		this.setValues( parameters );
 
-MeshDepthMaterial.prototype = Object.create( Material.prototype );
-MeshDepthMaterial.prototype.constructor = MeshDepthMaterial;
+	}
 
-MeshDepthMaterial.prototype.isMeshDepthMaterial = true;
+	copy( source ) {
 
-MeshDepthMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.depthPacking = source.depthPacking;
 
-	this.depthPacking = source.depthPacking;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
+		this.map = source.map;
 
-	this.map = source.map;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshDepthMaterial.prototype.isMeshDepthMaterial = true;
 
 export { MeshDepthMaterial };

+ 33 - 33
src/materials/MeshDistanceMaterial.js

@@ -22,60 +22,60 @@ import { Vector3 } from '../math/Vector3.js';
  * }
  */
 
-function MeshDistanceMaterial( parameters ) {
+class MeshDistanceMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshDistanceMaterial';
+		super();
 
-	this.referencePosition = new Vector3();
-	this.nearDistance = 1;
-	this.farDistance = 1000;
+		this.type = 'MeshDistanceMaterial';
 
-	this.skinning = false;
-	this.morphTargets = false;
+		this.referencePosition = new Vector3();
+		this.nearDistance = 1;
+		this.farDistance = 1000;
 
-	this.map = null;
+		this.skinning = false;
+		this.morphTargets = false;
 
-	this.alphaMap = null;
+		this.map = null;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.alphaMap = null;
 
-	this.fog = false;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.setValues( parameters );
+		this.fog = false;
 
-}
+		this.setValues( parameters );
 
-MeshDistanceMaterial.prototype = Object.create( Material.prototype );
-MeshDistanceMaterial.prototype.constructor = MeshDistanceMaterial;
+	}
 
-MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
+	copy( source ) {
 
-MeshDistanceMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.referencePosition.copy( source.referencePosition );
+		this.nearDistance = source.nearDistance;
+		this.farDistance = source.farDistance;
 
-	this.referencePosition.copy( source.referencePosition );
-	this.nearDistance = source.nearDistance;
-	this.farDistance = source.farDistance;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
+		this.map = source.map;
 
-	this.map = source.map;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
 
 export { MeshDistanceMaterial };

+ 56 - 56
src/materials/MeshLambertMaterial.js

@@ -37,92 +37,92 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshLambertMaterial( parameters ) {
+class MeshLambertMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshLambertMaterial';
+		super();
 
-	this.color = new Color( 0xffffff ); // diffuse
+		this.type = 'MeshLambertMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff ); // diffuse
 
-	this.lightMap = null;
-	this.lightMapIntensity = 1.0;
+		this.map = null;
 
-	this.aoMap = null;
-	this.aoMapIntensity = 1.0;
+		this.lightMap = null;
+		this.lightMapIntensity = 1.0;
 
-	this.emissive = new Color( 0x000000 );
-	this.emissiveIntensity = 1.0;
-	this.emissiveMap = null;
+		this.aoMap = null;
+		this.aoMapIntensity = 1.0;
 
-	this.specularMap = null;
+		this.emissive = new Color( 0x000000 );
+		this.emissiveIntensity = 1.0;
+		this.emissiveMap = null;
 
-	this.alphaMap = null;
+		this.specularMap = null;
 
-	this.envMap = null;
-	this.combine = MultiplyOperation;
-	this.reflectivity = 1;
-	this.refractionRatio = 0.98;
+		this.alphaMap = null;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
-	this.wireframeLinecap = 'round';
-	this.wireframeLinejoin = 'round';
+		this.envMap = null;
+		this.combine = MultiplyOperation;
+		this.reflectivity = 1;
+		this.refractionRatio = 0.98;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
+		this.wireframeLinecap = 'round';
+		this.wireframeLinejoin = 'round';
 
-	this.setValues( parameters );
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-}
+		this.setValues( parameters );
 
-MeshLambertMaterial.prototype = Object.create( Material.prototype );
-MeshLambertMaterial.prototype.constructor = MeshLambertMaterial;
+	}
 
-MeshLambertMaterial.prototype.isMeshLambertMaterial = true;
+	copy( source ) {
 
-MeshLambertMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
 
-	this.color.copy( source.color );
+		this.map = source.map;
 
-	this.map = source.map;
+		this.lightMap = source.lightMap;
+		this.lightMapIntensity = source.lightMapIntensity;
 
-	this.lightMap = source.lightMap;
-	this.lightMapIntensity = source.lightMapIntensity;
+		this.aoMap = source.aoMap;
+		this.aoMapIntensity = source.aoMapIntensity;
 
-	this.aoMap = source.aoMap;
-	this.aoMapIntensity = source.aoMapIntensity;
+		this.emissive.copy( source.emissive );
+		this.emissiveMap = source.emissiveMap;
+		this.emissiveIntensity = source.emissiveIntensity;
 
-	this.emissive.copy( source.emissive );
-	this.emissiveMap = source.emissiveMap;
-	this.emissiveIntensity = source.emissiveIntensity;
+		this.specularMap = source.specularMap;
 
-	this.specularMap = source.specularMap;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.envMap = source.envMap;
+		this.combine = source.combine;
+		this.reflectivity = source.reflectivity;
+		this.refractionRatio = source.refractionRatio;
 
-	this.envMap = source.envMap;
-	this.combine = source.combine;
-	this.reflectivity = source.reflectivity;
-	this.refractionRatio = source.refractionRatio;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
+		this.wireframeLinecap = source.wireframeLinecap;
+		this.wireframeLinejoin = source.wireframeLinejoin;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
-	this.wireframeLinecap = source.wireframeLinecap;
-	this.wireframeLinejoin = source.wireframeLinejoin;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshLambertMaterial.prototype.isMeshLambertMaterial = true;
 
 export { MeshLambertMaterial };

+ 47 - 46
src/materials/MeshMatcapMaterial.js

@@ -33,82 +33,83 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshMatcapMaterial( parameters ) {
+class MeshMatcapMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.defines = { 'MATCAP': '' };
+		super();
 
-	this.type = 'MeshMatcapMaterial';
+		this.defines = { 'MATCAP': '' };
 
-	this.color = new Color( 0xffffff ); // diffuse
+		this.type = 'MeshMatcapMaterial';
 
-	this.matcap = null;
+		this.color = new Color( 0xffffff ); // diffuse
 
-	this.map = null;
+		this.matcap = null;
 
-	this.bumpMap = null;
-	this.bumpScale = 1;
+		this.map = null;
 
-	this.normalMap = null;
-	this.normalMapType = TangentSpaceNormalMap;
-	this.normalScale = new Vector2( 1, 1 );
+		this.bumpMap = null;
+		this.bumpScale = 1;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.normalMap = null;
+		this.normalMapType = TangentSpaceNormalMap;
+		this.normalScale = new Vector2( 1, 1 );
 
-	this.alphaMap = null;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.alphaMap = null;
 
-	this.flatShading = false;
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-	this.setValues( parameters );
+		this.flatShading = false;
 
-}
+		this.setValues( parameters );
 
-MeshMatcapMaterial.prototype = Object.create( Material.prototype );
-MeshMatcapMaterial.prototype.constructor = MeshMatcapMaterial;
+	}
 
-MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;
 
-MeshMatcapMaterial.prototype.copy = function ( source ) {
+	copy( source ) {
 
-	Material.prototype.copy.call( this, source );
+		super.copy( source );
 
-	this.defines = { 'MATCAP': '' };
+		this.defines = { 'MATCAP': '' };
 
-	this.color.copy( source.color );
+		this.color.copy( source.color );
 
-	this.matcap = source.matcap;
+		this.matcap = source.matcap;
 
-	this.map = source.map;
+		this.map = source.map;
 
-	this.bumpMap = source.bumpMap;
-	this.bumpScale = source.bumpScale;
+		this.bumpMap = source.bumpMap;
+		this.bumpScale = source.bumpScale;
 
-	this.normalMap = source.normalMap;
-	this.normalMapType = source.normalMapType;
-	this.normalScale.copy( source.normalScale );
+		this.normalMap = source.normalMap;
+		this.normalMapType = source.normalMapType;
+		this.normalScale.copy( source.normalScale );
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.alphaMap = source.alphaMap;
+		this.alphaMap = source.alphaMap;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.flatShading = source.flatShading;
+		this.flatShading = source.flatShading;
 
-	return this;
+		return this;
 
-};
+	}
 
+}
+
+MeshMatcapMaterial.prototype.isMeshMatcapMaterial = true;
 
 export { MeshMatcapMaterial };

+ 41 - 41
src/materials/MeshNormalMaterial.js

@@ -28,70 +28,70 @@ import { Vector2 } from '../math/Vector2.js';
  * }
  */
 
-function MeshNormalMaterial( parameters ) {
+class MeshNormalMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshNormalMaterial';
+		super();
 
-	this.bumpMap = null;
-	this.bumpScale = 1;
+		this.type = 'MeshNormalMaterial';
 
-	this.normalMap = null;
-	this.normalMapType = TangentSpaceNormalMap;
-	this.normalScale = new Vector2( 1, 1 );
+		this.bumpMap = null;
+		this.bumpScale = 1;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.normalMap = null;
+		this.normalMapType = TangentSpaceNormalMap;
+		this.normalScale = new Vector2( 1, 1 );
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.fog = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.fog = false;
 
-	this.flatShading = false;
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-	this.setValues( parameters );
+		this.flatShading = false;
 
-}
+		this.setValues( parameters );
 
-MeshNormalMaterial.prototype = Object.create( Material.prototype );
-MeshNormalMaterial.prototype.constructor = MeshNormalMaterial;
+	}
 
-MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
+	copy( source ) {
 
-MeshNormalMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.bumpMap = source.bumpMap;
+		this.bumpScale = source.bumpScale;
 
-	this.bumpMap = source.bumpMap;
-	this.bumpScale = source.bumpScale;
+		this.normalMap = source.normalMap;
+		this.normalMapType = source.normalMapType;
+		this.normalScale.copy( source.normalScale );
 
-	this.normalMap = source.normalMap;
-	this.normalMapType = source.normalMapType;
-	this.normalScale.copy( source.normalScale );
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		this.flatShading = source.flatShading;
 
-	this.flatShading = source.flatShading;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshNormalMaterial.prototype.isMeshNormalMaterial = true;
 
 export { MeshNormalMaterial };

+ 78 - 78
src/materials/MeshPhongMaterial.js

@@ -53,122 +53,122 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshPhongMaterial( parameters ) {
+class MeshPhongMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'MeshPhongMaterial';
+		super();
 
-	this.color = new Color( 0xffffff ); // diffuse
-	this.specular = new Color( 0x111111 );
-	this.shininess = 30;
+		this.type = 'MeshPhongMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff ); // diffuse
+		this.specular = new Color( 0x111111 );
+		this.shininess = 30;
 
-	this.lightMap = null;
-	this.lightMapIntensity = 1.0;
+		this.map = null;
 
-	this.aoMap = null;
-	this.aoMapIntensity = 1.0;
+		this.lightMap = null;
+		this.lightMapIntensity = 1.0;
 
-	this.emissive = new Color( 0x000000 );
-	this.emissiveIntensity = 1.0;
-	this.emissiveMap = null;
+		this.aoMap = null;
+		this.aoMapIntensity = 1.0;
 
-	this.bumpMap = null;
-	this.bumpScale = 1;
+		this.emissive = new Color( 0x000000 );
+		this.emissiveIntensity = 1.0;
+		this.emissiveMap = null;
 
-	this.normalMap = null;
-	this.normalMapType = TangentSpaceNormalMap;
-	this.normalScale = new Vector2( 1, 1 );
+		this.bumpMap = null;
+		this.bumpScale = 1;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.normalMap = null;
+		this.normalMapType = TangentSpaceNormalMap;
+		this.normalScale = new Vector2( 1, 1 );
 
-	this.specularMap = null;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.alphaMap = null;
+		this.specularMap = null;
 
-	this.envMap = null;
-	this.combine = MultiplyOperation;
-	this.reflectivity = 1;
-	this.refractionRatio = 0.98;
+		this.alphaMap = null;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
-	this.wireframeLinecap = 'round';
-	this.wireframeLinejoin = 'round';
+		this.envMap = null;
+		this.combine = MultiplyOperation;
+		this.reflectivity = 1;
+		this.refractionRatio = 0.98;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
+		this.wireframeLinecap = 'round';
+		this.wireframeLinejoin = 'round';
 
-	this.flatShading = false;
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-	this.setValues( parameters );
+		this.flatShading = false;
 
-}
+		this.setValues( parameters );
 
-MeshPhongMaterial.prototype = Object.create( Material.prototype );
-MeshPhongMaterial.prototype.constructor = MeshPhongMaterial;
+	}
 
-MeshPhongMaterial.prototype.isMeshPhongMaterial = true;
+	copy( source ) {
 
-MeshPhongMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
+		this.specular.copy( source.specular );
+		this.shininess = source.shininess;
 
-	this.color.copy( source.color );
-	this.specular.copy( source.specular );
-	this.shininess = source.shininess;
+		this.map = source.map;
 
-	this.map = source.map;
+		this.lightMap = source.lightMap;
+		this.lightMapIntensity = source.lightMapIntensity;
 
-	this.lightMap = source.lightMap;
-	this.lightMapIntensity = source.lightMapIntensity;
+		this.aoMap = source.aoMap;
+		this.aoMapIntensity = source.aoMapIntensity;
 
-	this.aoMap = source.aoMap;
-	this.aoMapIntensity = source.aoMapIntensity;
+		this.emissive.copy( source.emissive );
+		this.emissiveMap = source.emissiveMap;
+		this.emissiveIntensity = source.emissiveIntensity;
 
-	this.emissive.copy( source.emissive );
-	this.emissiveMap = source.emissiveMap;
-	this.emissiveIntensity = source.emissiveIntensity;
+		this.bumpMap = source.bumpMap;
+		this.bumpScale = source.bumpScale;
 
-	this.bumpMap = source.bumpMap;
-	this.bumpScale = source.bumpScale;
+		this.normalMap = source.normalMap;
+		this.normalMapType = source.normalMapType;
+		this.normalScale.copy( source.normalScale );
 
-	this.normalMap = source.normalMap;
-	this.normalMapType = source.normalMapType;
-	this.normalScale.copy( source.normalScale );
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.specularMap = source.specularMap;
 
-	this.specularMap = source.specularMap;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.envMap = source.envMap;
+		this.combine = source.combine;
+		this.reflectivity = source.reflectivity;
+		this.refractionRatio = source.refractionRatio;
 
-	this.envMap = source.envMap;
-	this.combine = source.combine;
-	this.reflectivity = source.reflectivity;
-	this.refractionRatio = source.refractionRatio;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
+		this.wireframeLinecap = source.wireframeLinecap;
+		this.wireframeLinejoin = source.wireframeLinejoin;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
-	this.wireframeLinecap = source.wireframeLinecap;
-	this.wireframeLinejoin = source.wireframeLinejoin;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		this.flatShading = source.flatShading;
 
-	this.flatShading = source.flatShading;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshPhongMaterial.prototype.isMeshPhongMaterial = true;
 
 export { MeshPhongMaterial };

+ 54 - 52
src/materials/MeshPhysicalMaterial.js

@@ -22,90 +22,92 @@ import { MathUtils } from '../math/MathUtils.js';
  * }
  */
 
-function MeshPhysicalMaterial( parameters ) {
+class MeshPhysicalMaterial extends MeshStandardMaterial {
 
-	MeshStandardMaterial.call( this );
+	constructor( parameters ) {
 
-	this.defines = {
+		super();
 
-		'STANDARD': '',
-		'PHYSICAL': ''
+		this.defines = {
 
-	};
+			'STANDARD': '',
+			'PHYSICAL': ''
 
-	this.type = 'MeshPhysicalMaterial';
+		};
 
-	this.clearcoat = 0.0;
-	this.clearcoatMap = null;
-	this.clearcoatRoughness = 0.0;
-	this.clearcoatRoughnessMap = null;
-	this.clearcoatNormalScale = new Vector2( 1, 1 );
-	this.clearcoatNormalMap = null;
+		this.type = 'MeshPhysicalMaterial';
 
-	this.reflectivity = 0.5; // maps to F0 = 0.04
+		this.clearcoat = 0.0;
+		this.clearcoatMap = null;
+		this.clearcoatRoughness = 0.0;
+		this.clearcoatRoughnessMap = null;
+		this.clearcoatNormalScale = new Vector2( 1, 1 );
+		this.clearcoatNormalMap = null;
 
-	Object.defineProperty( this, 'ior', {
-		get: function () {
+		this.reflectivity = 0.5; // maps to F0 = 0.04
 
-			return ( 1 + 0.4 * this.reflectivity ) / ( 1 - 0.4 * this.reflectivity );
+		Object.defineProperty( this, 'ior', {
+			get: function () {
 
-		},
-		set: function ( ior ) {
+				return ( 1 + 0.4 * this.reflectivity ) / ( 1 - 0.4 * this.reflectivity );
 
-			this.reflectivity = MathUtils.clamp( 2.5 * ( ior - 1 ) / ( ior + 1 ), 0, 1 );
+			},
+			set: function ( ior ) {
 
-		}
-	} );
+				this.reflectivity = MathUtils.clamp( 2.5 * ( ior - 1 ) / ( ior + 1 ), 0, 1 );
 
-	this.sheen = null; // null will disable sheen bsdf
+			}
+		} );
 
-	this.transmission = 0.0;
-	this.transmissionMap = null;
 
-	this.setValues( parameters );
+		this.sheen = null; // null will disable sheen bsdf
 
-}
+		this.transmission = 0.0;
+		this.transmissionMap = null;
 
-MeshPhysicalMaterial.prototype = Object.create( MeshStandardMaterial.prototype );
-MeshPhysicalMaterial.prototype.constructor = MeshPhysicalMaterial;
+		this.setValues( parameters );
 
-MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
+	}
 
-MeshPhysicalMaterial.prototype.copy = function ( source ) {
+	copy( source ) {
 
-	MeshStandardMaterial.prototype.copy.call( this, source );
+		super.copy( source );
 
-	this.defines = {
+		this.defines = {
 
-		'STANDARD': '',
-		'PHYSICAL': ''
+			'STANDARD': '',
+			'PHYSICAL': ''
 
-	};
+		};
 
-	this.clearcoat = source.clearcoat;
-	this.clearcoatMap = source.clearcoatMap;
-	this.clearcoatRoughness = source.clearcoatRoughness;
-	this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
-	this.clearcoatNormalMap = source.clearcoatNormalMap;
-	this.clearcoatNormalScale.copy( source.clearcoatNormalScale );
+		this.clearcoat = source.clearcoat;
+		this.clearcoatMap = source.clearcoatMap;
+		this.clearcoatRoughness = source.clearcoatRoughness;
+		this.clearcoatRoughnessMap = source.clearcoatRoughnessMap;
+		this.clearcoatNormalMap = source.clearcoatNormalMap;
+		this.clearcoatNormalScale.copy( source.clearcoatNormalScale );
 
-	this.reflectivity = source.reflectivity;
+		this.reflectivity = source.reflectivity;
 
-	if ( source.sheen ) {
+		if ( source.sheen ) {
 
-		this.sheen = ( this.sheen || new Color() ).copy( source.sheen );
+			this.sheen = ( this.sheen || new Color() ).copy( source.sheen );
 
-	} else {
+		} else {
 
-		this.sheen = null;
+			this.sheen = null;
 
-	}
+		}
 
-	this.transmission = source.transmission;
-	this.transmissionMap = source.transmissionMap;
+		this.transmission = source.transmission;
+		this.transmissionMap = source.transmissionMap;
 
-	return this;
+		return this;
 
-};
+	}
+
+}
+
+MeshPhysicalMaterial.prototype.isMeshPhysicalMaterial = true;
 
 export { MeshPhysicalMaterial };

+ 82 - 82
src/materials/MeshStandardMaterial.js

@@ -55,134 +55,134 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshStandardMaterial( parameters ) {
+class MeshStandardMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.defines = { 'STANDARD': '' };
+		super();
 
-	this.type = 'MeshStandardMaterial';
+		this.defines = { 'STANDARD': '' };
 
-	this.color = new Color( 0xffffff ); // diffuse
-	this.roughness = 1.0;
-	this.metalness = 0.0;
+		this.type = 'MeshStandardMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff ); // diffuse
+		this.roughness = 1.0;
+		this.metalness = 0.0;
 
-	this.lightMap = null;
-	this.lightMapIntensity = 1.0;
+		this.map = null;
 
-	this.aoMap = null;
-	this.aoMapIntensity = 1.0;
+		this.lightMap = null;
+		this.lightMapIntensity = 1.0;
 
-	this.emissive = new Color( 0x000000 );
-	this.emissiveIntensity = 1.0;
-	this.emissiveMap = null;
+		this.aoMap = null;
+		this.aoMapIntensity = 1.0;
 
-	this.bumpMap = null;
-	this.bumpScale = 1;
+		this.emissive = new Color( 0x000000 );
+		this.emissiveIntensity = 1.0;
+		this.emissiveMap = null;
 
-	this.normalMap = null;
-	this.normalMapType = TangentSpaceNormalMap;
-	this.normalScale = new Vector2( 1, 1 );
+		this.bumpMap = null;
+		this.bumpScale = 1;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.normalMap = null;
+		this.normalMapType = TangentSpaceNormalMap;
+		this.normalScale = new Vector2( 1, 1 );
 
-	this.roughnessMap = null;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.metalnessMap = null;
+		this.roughnessMap = null;
 
-	this.alphaMap = null;
+		this.metalnessMap = null;
 
-	this.envMap = null;
-	this.envMapIntensity = 1.0;
+		this.alphaMap = null;
 
-	this.refractionRatio = 0.98;
+		this.envMap = null;
+		this.envMapIntensity = 1.0;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
-	this.wireframeLinecap = 'round';
-	this.wireframeLinejoin = 'round';
+		this.refractionRatio = 0.98;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
+		this.wireframeLinecap = 'round';
+		this.wireframeLinejoin = 'round';
 
-	this.flatShading = false;
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-	this.vertexTangents = false;
+		this.flatShading = false;
 
-	this.setValues( parameters );
+		this.vertexTangents = false;
 
-}
+		this.setValues( parameters );
 
-MeshStandardMaterial.prototype = Object.create( Material.prototype );
-MeshStandardMaterial.prototype.constructor = MeshStandardMaterial;
+	}
 
-MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
+	copy( source ) {
 
-MeshStandardMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.defines = { 'STANDARD': '' };
 
-	this.defines = { 'STANDARD': '' };
+		this.color.copy( source.color );
+		this.roughness = source.roughness;
+		this.metalness = source.metalness;
 
-	this.color.copy( source.color );
-	this.roughness = source.roughness;
-	this.metalness = source.metalness;
+		this.map = source.map;
 
-	this.map = source.map;
+		this.lightMap = source.lightMap;
+		this.lightMapIntensity = source.lightMapIntensity;
 
-	this.lightMap = source.lightMap;
-	this.lightMapIntensity = source.lightMapIntensity;
+		this.aoMap = source.aoMap;
+		this.aoMapIntensity = source.aoMapIntensity;
 
-	this.aoMap = source.aoMap;
-	this.aoMapIntensity = source.aoMapIntensity;
+		this.emissive.copy( source.emissive );
+		this.emissiveMap = source.emissiveMap;
+		this.emissiveIntensity = source.emissiveIntensity;
 
-	this.emissive.copy( source.emissive );
-	this.emissiveMap = source.emissiveMap;
-	this.emissiveIntensity = source.emissiveIntensity;
+		this.bumpMap = source.bumpMap;
+		this.bumpScale = source.bumpScale;
 
-	this.bumpMap = source.bumpMap;
-	this.bumpScale = source.bumpScale;
+		this.normalMap = source.normalMap;
+		this.normalMapType = source.normalMapType;
+		this.normalScale.copy( source.normalScale );
 
-	this.normalMap = source.normalMap;
-	this.normalMapType = source.normalMapType;
-	this.normalScale.copy( source.normalScale );
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.roughnessMap = source.roughnessMap;
 
-	this.roughnessMap = source.roughnessMap;
+		this.metalnessMap = source.metalnessMap;
 
-	this.metalnessMap = source.metalnessMap;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.envMap = source.envMap;
+		this.envMapIntensity = source.envMapIntensity;
 
-	this.envMap = source.envMap;
-	this.envMapIntensity = source.envMapIntensity;
+		this.refractionRatio = source.refractionRatio;
 
-	this.refractionRatio = source.refractionRatio;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
+		this.wireframeLinecap = source.wireframeLinecap;
+		this.wireframeLinejoin = source.wireframeLinejoin;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
-	this.wireframeLinecap = source.wireframeLinecap;
-	this.wireframeLinejoin = source.wireframeLinejoin;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		this.flatShading = source.flatShading;
 
-	this.flatShading = source.flatShading;
+		this.vertexTangents = source.vertexTangents;
 
-	this.vertexTangents = source.vertexTangents;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
 
 export { MeshStandardMaterial };

+ 65 - 65
src/materials/MeshToonMaterial.js

@@ -42,104 +42,104 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function MeshToonMaterial( parameters ) {
+class MeshToonMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.defines = { 'TOON': '' };
+		super();
 
-	this.type = 'MeshToonMaterial';
+		this.defines = { 'TOON': '' };
 
-	this.color = new Color( 0xffffff );
+		this.type = 'MeshToonMaterial';
 
-	this.map = null;
-	this.gradientMap = null;
+		this.color = new Color( 0xffffff );
 
-	this.lightMap = null;
-	this.lightMapIntensity = 1.0;
+		this.map = null;
+		this.gradientMap = null;
 
-	this.aoMap = null;
-	this.aoMapIntensity = 1.0;
+		this.lightMap = null;
+		this.lightMapIntensity = 1.0;
 
-	this.emissive = new Color( 0x000000 );
-	this.emissiveIntensity = 1.0;
-	this.emissiveMap = null;
+		this.aoMap = null;
+		this.aoMapIntensity = 1.0;
 
-	this.bumpMap = null;
-	this.bumpScale = 1;
+		this.emissive = new Color( 0x000000 );
+		this.emissiveIntensity = 1.0;
+		this.emissiveMap = null;
 
-	this.normalMap = null;
-	this.normalMapType = TangentSpaceNormalMap;
-	this.normalScale = new Vector2( 1, 1 );
+		this.bumpMap = null;
+		this.bumpScale = 1;
 
-	this.displacementMap = null;
-	this.displacementScale = 1;
-	this.displacementBias = 0;
+		this.normalMap = null;
+		this.normalMapType = TangentSpaceNormalMap;
+		this.normalScale = new Vector2( 1, 1 );
 
-	this.alphaMap = null;
+		this.displacementMap = null;
+		this.displacementScale = 1;
+		this.displacementBias = 0;
 
-	this.wireframe = false;
-	this.wireframeLinewidth = 1;
-	this.wireframeLinecap = 'round';
-	this.wireframeLinejoin = 'round';
+		this.alphaMap = null;
 
-	this.skinning = false;
-	this.morphTargets = false;
-	this.morphNormals = false;
+		this.wireframe = false;
+		this.wireframeLinewidth = 1;
+		this.wireframeLinecap = 'round';
+		this.wireframeLinejoin = 'round';
 
-	this.setValues( parameters );
+		this.skinning = false;
+		this.morphTargets = false;
+		this.morphNormals = false;
 
-}
+		this.setValues( parameters );
 
-MeshToonMaterial.prototype = Object.create( Material.prototype );
-MeshToonMaterial.prototype.constructor = MeshToonMaterial;
+	}
 
-MeshToonMaterial.prototype.isMeshToonMaterial = true;
+	copy( source ) {
 
-MeshToonMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
 
-	this.color.copy( source.color );
+		this.map = source.map;
+		this.gradientMap = source.gradientMap;
 
-	this.map = source.map;
-	this.gradientMap = source.gradientMap;
+		this.lightMap = source.lightMap;
+		this.lightMapIntensity = source.lightMapIntensity;
 
-	this.lightMap = source.lightMap;
-	this.lightMapIntensity = source.lightMapIntensity;
+		this.aoMap = source.aoMap;
+		this.aoMapIntensity = source.aoMapIntensity;
 
-	this.aoMap = source.aoMap;
-	this.aoMapIntensity = source.aoMapIntensity;
+		this.emissive.copy( source.emissive );
+		this.emissiveMap = source.emissiveMap;
+		this.emissiveIntensity = source.emissiveIntensity;
 
-	this.emissive.copy( source.emissive );
-	this.emissiveMap = source.emissiveMap;
-	this.emissiveIntensity = source.emissiveIntensity;
+		this.bumpMap = source.bumpMap;
+		this.bumpScale = source.bumpScale;
 
-	this.bumpMap = source.bumpMap;
-	this.bumpScale = source.bumpScale;
+		this.normalMap = source.normalMap;
+		this.normalMapType = source.normalMapType;
+		this.normalScale.copy( source.normalScale );
 
-	this.normalMap = source.normalMap;
-	this.normalMapType = source.normalMapType;
-	this.normalScale.copy( source.normalScale );
+		this.displacementMap = source.displacementMap;
+		this.displacementScale = source.displacementScale;
+		this.displacementBias = source.displacementBias;
 
-	this.displacementMap = source.displacementMap;
-	this.displacementScale = source.displacementScale;
-	this.displacementBias = source.displacementBias;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.wireframe = source.wireframe;
+		this.wireframeLinewidth = source.wireframeLinewidth;
+		this.wireframeLinecap = source.wireframeLinecap;
+		this.wireframeLinejoin = source.wireframeLinejoin;
 
-	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
-	this.wireframeLinecap = source.wireframeLinecap;
-	this.wireframeLinejoin = source.wireframeLinejoin;
+		this.skinning = source.skinning;
+		this.morphTargets = source.morphTargets;
+		this.morphNormals = source.morphNormals;
 
-	this.skinning = source.skinning;
-	this.morphTargets = source.morphTargets;
-	this.morphNormals = source.morphNormals;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+MeshToonMaterial.prototype.isMeshToonMaterial = true;
 
 export { MeshToonMaterial };

+ 24 - 24
src/materials/PointsMaterial.js

@@ -15,50 +15,50 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function PointsMaterial( parameters ) {
+class PointsMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'PointsMaterial';
+		super();
 
-	this.color = new Color( 0xffffff );
+		this.type = 'PointsMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff );
 
-	this.alphaMap = null;
+		this.map = null;
 
-	this.size = 1;
-	this.sizeAttenuation = true;
+		this.alphaMap = null;
 
-	this.morphTargets = false;
+		this.size = 1;
+		this.sizeAttenuation = true;
 
-	this.setValues( parameters );
+		this.morphTargets = false;
 
-}
+		this.setValues( parameters );
 
-PointsMaterial.prototype = Object.create( Material.prototype );
-PointsMaterial.prototype.constructor = PointsMaterial;
+	}
 
-PointsMaterial.prototype.isPointsMaterial = true;
+	copy( source ) {
 
-PointsMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
 
-	this.color.copy( source.color );
+		this.map = source.map;
 
-	this.map = source.map;
+		this.alphaMap = source.alphaMap;
 
-	this.alphaMap = source.alphaMap;
+		this.size = source.size;
+		this.sizeAttenuation = source.sizeAttenuation;
 
-	this.size = source.size;
-	this.sizeAttenuation = source.sizeAttenuation;
+		this.morphTargets = source.morphTargets;
 
-	this.morphTargets = source.morphTargets;
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+PointsMaterial.prototype.isPointsMaterial = true;
 
 export { PointsMaterial };

+ 7 - 7
src/materials/RawShaderMaterial.js

@@ -1,17 +1,17 @@
 import { ShaderMaterial } from './ShaderMaterial.js';
 
-function RawShaderMaterial( parameters ) {
+class RawShaderMaterial extends ShaderMaterial {
 
-	ShaderMaterial.call( this, parameters );
+	constructor( parameters ) {
 
-	this.type = 'RawShaderMaterial';
+		super( parameters );
 
-}
+		this.type = 'RawShaderMaterial';
 
-RawShaderMaterial.prototype = Object.create( ShaderMaterial.prototype );
-RawShaderMaterial.prototype.constructor = RawShaderMaterial;
+	}
 
-RawShaderMaterial.prototype.isRawShaderMaterial = true;
+}
 
+RawShaderMaterial.prototype.isRawShaderMaterial = true;
 
 export { RawShaderMaterial };

+ 15 - 15
src/materials/ShadowMaterial.js

@@ -7,33 +7,33 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function ShadowMaterial( parameters ) {
+class ShadowMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'ShadowMaterial';
+		super();
 
-	this.color = new Color( 0x000000 );
-	this.transparent = true;
+		this.type = 'ShadowMaterial';
 
-	this.setValues( parameters );
+		this.color = new Color( 0x000000 );
+		this.transparent = true;
 
-}
+		this.setValues( parameters );
 
-ShadowMaterial.prototype = Object.create( Material.prototype );
-ShadowMaterial.prototype.constructor = ShadowMaterial;
+	}
 
-ShadowMaterial.prototype.isShadowMaterial = true;
+	copy( source ) {
 
-ShadowMaterial.prototype.copy = function ( source ) {
+		super.copy( source );
 
-	Material.prototype.copy.call( this, source );
+		this.color.copy( source.color );
 
-	this.color.copy( source.color );
+		return this;
 
-	return this;
+	}
 
-};
+}
 
+ShadowMaterial.prototype.isShadowMaterial = true;
 
 export { ShadowMaterial };

+ 24 - 23
src/materials/SpriteMaterial.js

@@ -11,49 +11,50 @@ import { Color } from '../math/Color.js';
  * }
  */
 
-function SpriteMaterial( parameters ) {
+class SpriteMaterial extends Material {
 
-	Material.call( this );
+	constructor( parameters ) {
 
-	this.type = 'SpriteMaterial';
+		super();
 
-	this.color = new Color( 0xffffff );
+		this.type = 'SpriteMaterial';
 
-	this.map = null;
+		this.color = new Color( 0xffffff );
 
-	this.alphaMap = null;
+		this.map = null;
 
-	this.rotation = 0;
+		this.alphaMap = null;
 
-	this.sizeAttenuation = true;
+		this.rotation = 0;
 
-	this.transparent = true;
+		this.sizeAttenuation = true;
 
-	this.setValues( parameters );
+		this.transparent = true;
 
-}
+		this.setValues( parameters );
 
-SpriteMaterial.prototype = Object.create( Material.prototype );
-SpriteMaterial.prototype.constructor = SpriteMaterial;
-SpriteMaterial.prototype.isSpriteMaterial = true;
+	}
 
-SpriteMaterial.prototype.copy = function ( source ) {
+	copy( source ) {
 
-	Material.prototype.copy.call( this, source );
+		super.copy( source );
 
-	this.color.copy( source.color );
+		this.color.copy( source.color );
 
-	this.map = source.map;
+		this.map = source.map;
 
-	this.alphaMap = source.alphaMap;
+		this.alphaMap = source.alphaMap;
 
-	this.rotation = source.rotation;
+		this.rotation = source.rotation;
 
-	this.sizeAttenuation = source.sizeAttenuation;
+		this.sizeAttenuation = source.sizeAttenuation;
 
-	return this;
+		return this;
 
-};
+	}
 
+}
+
+SpriteMaterial.prototype.isSpriteMaterial = true;
 
 export { SpriteMaterial };