|
@@ -1,4 +1,4 @@
|
|
-import { MeshStandardMaterialCommon } from './MeshStandardMaterialCommon';
|
|
|
|
|
|
+import { Material } from './Material';
|
|
import { Vector2 } from '../math/Vector2';
|
|
import { Vector2 } from '../math/Vector2';
|
|
import { Color } from '../math/Color';
|
|
import { Color } from '../math/Color';
|
|
|
|
|
|
@@ -6,52 +6,168 @@ import { Color } from '../math/Color';
|
|
* @author takahiro / http://github.com/takahirox
|
|
* @author takahiro / http://github.com/takahirox
|
|
*
|
|
*
|
|
* parameters = {
|
|
* parameters = {
|
|
|
|
+ * color: <hex>,
|
|
* glossiness: <float>,
|
|
* glossiness: <float>,
|
|
* specular2: <hex>,
|
|
* specular2: <hex>,
|
|
|
|
+ * opacity: <float>,
|
|
|
|
+ *
|
|
|
|
+ * map: 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> ),
|
|
|
|
+ * normalScale: <Vector2>,
|
|
|
|
+ *
|
|
|
|
+ * displacementMap: new THREE.Texture( <Image> ),
|
|
|
|
+ * displacementScale: <float>,
|
|
|
|
+ * displacementBias: <float>,
|
|
*
|
|
*
|
|
* glossinessMap: new THREE.Texture( <Image> ),
|
|
* glossinessMap: new THREE.Texture( <Image> ),
|
|
*
|
|
*
|
|
* specular2Map: new THREE.Texture( <Image> ),
|
|
* specular2Map: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * alphaMap: new THREE.Texture( <Image> ),
|
|
|
|
+ *
|
|
|
|
+ * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
|
|
|
|
+ * envMapIntensity: <float>
|
|
|
|
+ *
|
|
|
|
+ * refractionRatio: <float>,
|
|
|
|
+ *
|
|
|
|
+ * wireframe: <boolean>,
|
|
|
|
+ * wireframeLinewidth: <float>,
|
|
|
|
+ *
|
|
|
|
+ * skinning: <bool>,
|
|
|
|
+ * morphTargets: <bool>,
|
|
|
|
+ * morphNormals: <bool>
|
|
* }
|
|
* }
|
|
*/
|
|
*/
|
|
|
|
|
|
function MeshStandardMaterialSG( parameters ) {
|
|
function MeshStandardMaterialSG( parameters ) {
|
|
|
|
|
|
- MeshStandardMaterialCommon.call( this );
|
|
|
|
|
|
+ Material.call( this );
|
|
|
|
|
|
- this.defines[ 'STANDARD_SG' ] = '';
|
|
|
|
|
|
+ this.defines = { 'STANDARD': '', 'STANDARD_SG': '' };
|
|
|
|
|
|
this.type = 'MeshStandardMaterialSG';
|
|
this.type = 'MeshStandardMaterialSG';
|
|
|
|
|
|
|
|
+ this.color = new Color( 0xffffff ); // diffuse
|
|
this.glossiness = 0.5;
|
|
this.glossiness = 0.5;
|
|
this.specular2 = new Color ( 0x000000 );
|
|
this.specular2 = new Color ( 0x000000 );
|
|
|
|
|
|
|
|
+ this.map = 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.normalScale = new Vector2( 1, 1 );
|
|
|
|
+
|
|
|
|
+ this.displacementMap = null;
|
|
|
|
+ this.displacementScale = 1;
|
|
|
|
+ this.displacementBias = 0;
|
|
|
|
+
|
|
this.glossinessMap = null;
|
|
this.glossinessMap = null;
|
|
|
|
|
|
this.specular2Map = null;
|
|
this.specular2Map = null;
|
|
|
|
|
|
|
|
+ this.alphaMap = null;
|
|
|
|
+
|
|
|
|
+ this.envMap = null;
|
|
|
|
+ this.envMapIntensity = 1.0;
|
|
|
|
+
|
|
|
|
+ this.refractionRatio = 0.98;
|
|
|
|
+
|
|
|
|
+ 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 );
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-MeshStandardMaterialSG.prototype = Object.create( MeshStandardMaterialCommon.prototype );
|
|
|
|
|
|
+MeshStandardMaterialSG.prototype = Object.create( Material.prototype );
|
|
MeshStandardMaterialSG.prototype.constructor = MeshStandardMaterialSG;
|
|
MeshStandardMaterialSG.prototype.constructor = MeshStandardMaterialSG;
|
|
|
|
|
|
MeshStandardMaterialSG.prototype.isMeshStandardMaterialSG = true;
|
|
MeshStandardMaterialSG.prototype.isMeshStandardMaterialSG = true;
|
|
|
|
|
|
MeshStandardMaterialSG.prototype.copy = function ( source ) {
|
|
MeshStandardMaterialSG.prototype.copy = function ( source ) {
|
|
|
|
|
|
- MeshStandardMaterialCommon.prototype.copy.call( this, source );
|
|
|
|
|
|
+ Material.prototype.copy.call( this, source );
|
|
|
|
|
|
- this.defines[ 'STANDARD_SG' ] = '';
|
|
|
|
|
|
+ this.defines = { 'STANDARD': '' };
|
|
|
|
|
|
|
|
+ this.color.copy( source.color );
|
|
this.glossiness = source.glossiness;
|
|
this.glossiness = source.glossiness;
|
|
this.speculars.copy( source.specular2 );
|
|
this.speculars.copy( source.specular2 );
|
|
|
|
|
|
|
|
+ this.map = source.map;
|
|
|
|
+
|
|
|
|
+ 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.normalScale.copy( source.normalScale );
|
|
|
|
+
|
|
|
|
+ this.displacementMap = source.displacementMap;
|
|
|
|
+ this.displacementScale = source.displacementScale;
|
|
|
|
+ this.displacementBias = source.displacementBias;
|
|
|
|
+
|
|
this.glossinessMap = source.glossinessMap;
|
|
this.glossinessMap = source.glossinessMap;
|
|
|
|
|
|
this.specular2Map = source.specular2Map;
|
|
this.specular2Map = source.specular2Map;
|
|
|
|
|
|
|
|
+ this.alphaMap = source.alphaMap;
|
|
|
|
+
|
|
|
|
+ this.envMap = source.envMap;
|
|
|
|
+ this.envMapIntensity = source.envMapIntensity;
|
|
|
|
+
|
|
|
|
+ this.refractionRatio = source.refractionRatio;
|
|
|
|
+
|
|
|
|
+ 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;
|
|
|
|
|
|
};
|
|
};
|