|
@@ -0,0 +1,191 @@
|
|
|
+/**
|
|
|
+ * @author WestLangley / http://github.com/WestLangley
|
|
|
+ *
|
|
|
+ * parameters = {
|
|
|
+ * color: <hex>,
|
|
|
+ * roughness: <float>,
|
|
|
+ * reflectivity: <float>,
|
|
|
+ * metalness: <float>,
|
|
|
+
|
|
|
+ * emissive: <hex>,
|
|
|
+ * opacity: <float>,
|
|
|
+ *
|
|
|
+ * map: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * lightMap: new THREE.Texture( <Image> ),
|
|
|
+ * lightMapIntensity: <float>
|
|
|
+ *
|
|
|
+ * aoMap: new THREE.Texture( <Image> ),
|
|
|
+ * aoMapIntensity: <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>,
|
|
|
+ *
|
|
|
+ * roughnessMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * reflectivityMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * metalnessMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * alphaMap: new THREE.Texture( <Image> ),
|
|
|
+ *
|
|
|
+ * envMap: new THREE.CubeTexture( [posx, negx, posy, negy, posz, negz] ),
|
|
|
+ * refractionRatio: <float>,
|
|
|
+ *
|
|
|
+ * shading: THREE.SmoothShading,
|
|
|
+ * blending: THREE.NormalBlending,
|
|
|
+ * depthTest: <bool>,
|
|
|
+ * depthWrite: <bool>,
|
|
|
+ *
|
|
|
+ * wireframe: <boolean>,
|
|
|
+ * wireframeLinewidth: <float>,
|
|
|
+ *
|
|
|
+ * vertexColors: THREE.NoColors / THREE.VertexColors / THREE.FaceColors,
|
|
|
+ *
|
|
|
+ * skinning: <bool>,
|
|
|
+ * morphTargets: <bool>,
|
|
|
+ * morphNormals: <bool>,
|
|
|
+ *
|
|
|
+ * fog: <bool>
|
|
|
+ * }
|
|
|
+ */
|
|
|
+
|
|
|
+THREE.MeshStandardMaterial = function ( parameters ) {
|
|
|
+
|
|
|
+ THREE.Material.call( this );
|
|
|
+
|
|
|
+ this.type = 'MeshStandardMaterial';
|
|
|
+
|
|
|
+ this.color = new THREE.Color( 0xffffff ); // diffuse
|
|
|
+ this.roughness = 0.5;
|
|
|
+ this.reflectivity = 1;
|
|
|
+ this.metalness = 0;
|
|
|
+
|
|
|
+ this.emissive = new THREE.Color( 0x000000 );
|
|
|
+
|
|
|
+ this.map = null;
|
|
|
+
|
|
|
+ this.lightMap = null;
|
|
|
+ this.lightMapIntensity = 1.0;
|
|
|
+
|
|
|
+ this.aoMap = null;
|
|
|
+ this.aoMapIntensity = 1.0;
|
|
|
+
|
|
|
+ this.emissiveMap = null;
|
|
|
+
|
|
|
+ this.bumpMap = null;
|
|
|
+ this.bumpScale = 1;
|
|
|
+
|
|
|
+ this.normalMap = null;
|
|
|
+ this.normalScale = new THREE.Vector2( 1, 1 );
|
|
|
+
|
|
|
+ this.displacementMap = null;
|
|
|
+ this.displacementScale = 1;
|
|
|
+ this.displacementBias = 0;
|
|
|
+
|
|
|
+ this.roughnessMap = null;
|
|
|
+
|
|
|
+ this.reflectivityMap = null;
|
|
|
+
|
|
|
+ this.metalnessMap = null;
|
|
|
+
|
|
|
+ this.alphaMap = null;
|
|
|
+
|
|
|
+ this.envMap = null;
|
|
|
+ this.envMapIntensity = 1.0;
|
|
|
+
|
|
|
+ this.refractionRatio = 0.98;
|
|
|
+
|
|
|
+ this.fog = true;
|
|
|
+
|
|
|
+ this.shading = THREE.SmoothShading;
|
|
|
+
|
|
|
+ this.wireframe = false;
|
|
|
+ this.wireframeLinewidth = 1;
|
|
|
+ this.wireframeLinecap = 'round';
|
|
|
+ this.wireframeLinejoin = 'round';
|
|
|
+
|
|
|
+ this.vertexColors = THREE.NoColors;
|
|
|
+
|
|
|
+ this.skinning = false;
|
|
|
+ this.morphTargets = false;
|
|
|
+ this.morphNormals = false;
|
|
|
+
|
|
|
+ this.setValues( parameters );
|
|
|
+
|
|
|
+};
|
|
|
+
|
|
|
+THREE.MeshStandardMaterial.prototype = Object.create( THREE.Material.prototype );
|
|
|
+THREE.MeshStandardMaterial.prototype.constructor = THREE.MeshStandardMaterial;
|
|
|
+
|
|
|
+THREE.MeshStandardMaterial.prototype.copy = function ( source ) {
|
|
|
+
|
|
|
+ THREE.Material.prototype.copy.call( this, source );
|
|
|
+
|
|
|
+ this.color.copy( source.color );
|
|
|
+ this.roughness = source.roughness;
|
|
|
+ this.reflectivity = source.reflectivity;
|
|
|
+ this.metalness = source.metalness;
|
|
|
+
|
|
|
+ this.emissive.copy( source.emissive );
|
|
|
+
|
|
|
+ this.map = source.map;
|
|
|
+
|
|
|
+ this.lightMap = source.lightMap;
|
|
|
+ this.lightMapIntensity = source.lightMapIntensity;
|
|
|
+
|
|
|
+ this.aoMap = source.aoMap;
|
|
|
+ this.aoMapIntensity = source.aoMapIntensity;
|
|
|
+
|
|
|
+ this.emissiveMap = source.emissiveMap;
|
|
|
+
|
|
|
+ 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.roughnessMap = source.roughnessMap;
|
|
|
+
|
|
|
+ this.reflectivityMap = source.reflectivityMap;
|
|
|
+
|
|
|
+ this.metalnessMap = source.metalnessMap;
|
|
|
+
|
|
|
+ this.alphaMap = source.alphaMap;
|
|
|
+
|
|
|
+ this.envMap = source.envMap;
|
|
|
+ this.envMapIntensity = source.envMapIntensity;
|
|
|
+
|
|
|
+ this.refractionRatio = source.refractionRatio;
|
|
|
+
|
|
|
+ this.fog = source.fog;
|
|
|
+
|
|
|
+ this.shading = source.shading;
|
|
|
+
|
|
|
+ this.wireframe = source.wireframe;
|
|
|
+ this.wireframeLinewidth = source.wireframeLinewidth;
|
|
|
+ this.wireframeLinecap = source.wireframeLinecap;
|
|
|
+ this.wireframeLinejoin = source.wireframeLinejoin;
|
|
|
+
|
|
|
+ this.vertexColors = source.vertexColors;
|
|
|
+
|
|
|
+ this.skinning = source.skinning;
|
|
|
+ this.morphTargets = source.morphTargets;
|
|
|
+ this.morphNormals = source.morphNormals;
|
|
|
+
|
|
|
+ return this;
|
|
|
+
|
|
|
+};
|