|
@@ -1,38 +1,156 @@
|
|
-import { MeshPhongMaterial } from './MeshPhongMaterial.js';
|
|
|
|
|
|
+import { TangentSpaceNormalMap } from '../constants.js';
|
|
|
|
+import { Material } from './Material.js';
|
|
|
|
+import { Vector2 } from '../math/Vector2.js';
|
|
|
|
+import { Color } from '../math/Color.js';
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author takahirox / http://github.com/takahirox
|
|
* @author takahirox / http://github.com/takahirox
|
|
*
|
|
*
|
|
* parameters = {
|
|
* parameters = {
|
|
- * gradientMap: new THREE.Texture( <Image> )
|
|
|
|
|
|
+ * color: <hex>,
|
|
|
|
+ * specular: <hex>,
|
|
|
|
+ * shininess: <float>,
|
|
|
|
+ *
|
|
|
|
+ * map: new THREE.Texture( <Image> ),
|
|
|
|
+ * gradientMap: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * lightMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * lightMapIntensity: <float>
|
|
|
|
+ *
|
|
|
|
+ * aoMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * aoMapIntensity: <float>
|
|
|
|
+ *
|
|
|
|
+ * emissive: <hex>,
|
|
|
|
+ * emissiveIntensity: <float>
|
|
|
|
+ * emissiveMap: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * bumpMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * bumpScale: <float>,
|
|
|
|
+ *
|
|
|
|
+ * normalMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * normalMapType: THREE.TangentSpaceNormalMap,
|
|
|
|
+ * normalScale: <Vector2>,
|
|
|
|
+ *
|
|
|
|
+ * displacementMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * displacementScale: <float>,
|
|
|
|
+ * displacementBias: <float>,
|
|
|
|
+ *
|
|
|
|
+ * specularMap: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * alphaMap: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * wireframe: <boolean>,
|
|
|
|
+ * wireframeLinewidth: <float>,
|
|
|
|
+ *
|
|
|
|
+ * skinning: <bool>,
|
|
|
|
+ * morphTargets: <bool>,
|
|
|
|
+ * morphNormals: <bool>
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
|
|
|
|
function MeshToonMaterial( parameters ) {
|
|
function MeshToonMaterial( parameters ) {
|
|
|
|
|
|
- MeshPhongMaterial.call( this );
|
|
|
|
|
|
+ Material.call( this );
|
|
|
|
|
|
this.defines = { 'TOON': '' };
|
|
this.defines = { 'TOON': '' };
|
|
|
|
|
|
this.type = 'MeshToonMaterial';
|
|
this.type = 'MeshToonMaterial';
|
|
|
|
|
|
|
|
+ this.color = new Color( 0xffffff );
|
|
|
|
+ this.specular = new Color( 0x111111 );
|
|
|
|
+ this.shininess = 30;
|
|
|
|
+
|
|
|
|
+ this.map = null;
|
|
this.gradientMap = null;
|
|
this.gradientMap = null;
|
|
|
|
|
|
|
|
+ this.lightMap = null;
|
|
|
|
+ this.lightMapIntensity = 1.0;
|
|
|
|
+
|
|
|
|
+ this.aoMap = null;
|
|
|
|
+ this.aoMapIntensity = 1.0;
|
|
|
|
+
|
|
|
|
+ this.emissive = new Color( 0x000000 );
|
|
|
|
+ this.emissiveIntensity = 1.0;
|
|
|
|
+ this.emissiveMap = null;
|
|
|
|
+
|
|
|
|
+ this.bumpMap = null;
|
|
|
|
+ this.bumpScale = 1;
|
|
|
|
+
|
|
|
|
+ this.normalMap = null;
|
|
|
|
+ this.normalMapType = TangentSpaceNormalMap;
|
|
|
|
+ this.normalScale = new Vector2( 1, 1 );
|
|
|
|
+
|
|
|
|
+ this.displacementMap = null;
|
|
|
|
+ this.displacementScale = 1;
|
|
|
|
+ this.displacementBias = 0;
|
|
|
|
+
|
|
|
|
+ this.specularMap = null;
|
|
|
|
+
|
|
|
|
+ this.alphaMap = null;
|
|
|
|
+
|
|
|
|
+ this.wireframe = false;
|
|
|
|
+ this.wireframeLinewidth = 1;
|
|
|
|
+ this.wireframeLinecap = 'round';
|
|
|
|
+ this.wireframeLinejoin = 'round';
|
|
|
|
+
|
|
|
|
+ this.skinning = false;
|
|
|
|
+ this.morphTargets = false;
|
|
|
|
+ this.morphNormals = false;
|
|
|
|
+
|
|
this.setValues( parameters );
|
|
this.setValues( parameters );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-MeshToonMaterial.prototype = Object.create( MeshPhongMaterial.prototype );
|
|
|
|
|
|
+MeshToonMaterial.prototype = Object.create( Material.prototype );
|
|
MeshToonMaterial.prototype.constructor = MeshToonMaterial;
|
|
MeshToonMaterial.prototype.constructor = MeshToonMaterial;
|
|
|
|
|
|
MeshToonMaterial.prototype.isMeshToonMaterial = true;
|
|
MeshToonMaterial.prototype.isMeshToonMaterial = true;
|
|
|
|
|
|
MeshToonMaterial.prototype.copy = function ( source ) {
|
|
MeshToonMaterial.prototype.copy = function ( source ) {
|
|
|
|
|
|
- MeshPhongMaterial.prototype.copy.call( this, source );
|
|
|
|
|
|
+ Material.prototype.copy.call( this, source );
|
|
|
|
+
|
|
|
|
+ this.color.copy( source.color );
|
|
|
|
+ this.specular.copy( source.specular );
|
|
|
|
+ this.shininess = source.shininess;
|
|
|
|
|
|
|
|
+ this.map = source.map;
|
|
this.gradientMap = source.gradientMap;
|
|
this.gradientMap = source.gradientMap;
|
|
|
|
|
|
|
|
+ this.lightMap = source.lightMap;
|
|
|
|
+ this.lightMapIntensity = source.lightMapIntensity;
|
|
|
|
+
|
|
|
|
+ this.aoMap = source.aoMap;
|
|
|
|
+ this.aoMapIntensity = source.aoMapIntensity;
|
|
|
|
+
|
|
|
|
+ this.emissive.copy( source.emissive );
|
|
|
|
+ this.emissiveMap = source.emissiveMap;
|
|
|
|
+ this.emissiveIntensity = source.emissiveIntensity;
|
|
|
|
+
|
|
|
|
+ this.bumpMap = source.bumpMap;
|
|
|
|
+ this.bumpScale = source.bumpScale;
|
|
|
|
+
|
|
|
|
+ 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.specularMap = source.specularMap;
|
|
|
|
+
|
|
|
|
+ this.alphaMap = source.alphaMap;
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
+
|
|
return this;
|
|
return this;
|
|
|
|
|
|
};
|
|
};
|