Преглед изворни кода

MeshPhongMaterial: Removed metal property. Now that we have MeshPhysicalMaterial...

Mr.doob пре 9 година
родитељ
комит
bccaa60fa9

+ 0 - 7
docs/api/materials/MeshPhongMaterial.html

@@ -70,13 +70,6 @@
 		<h3>[property:Float shininess]</h3>
 		<div>How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.</div>
 
-		<h3>[property:boolean metal]</h3>
-		<div>
-			If set to true the shader multiplies the specular highlight by the underlying color of the object, making
-			it appear to be more metal-like and darker. If set to false the specular highlight is added ontop of the
-			underlying colors.
-		</div>
-
 		<h3>[property:Texture map]</h3>
 		<div>Set color texture map. Default is null. The texture map color is modulated by the diffuse color.</div>
 

+ 13 - 1
src/Three.Legacy.js

@@ -348,10 +348,22 @@ Object.defineProperties( THREE, {
 	}
 } );
 
+Object.defineProperties( THREE.MeshPhongMaterial.prototype, {
+	metal: {
+		get: function () {
+			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshPhysicalMaterial instead.' );
+			return false;
+		},
+		set: function ( value ) {
+			console.warn( 'THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshPhysicalMaterial instead' );
+		}
+	}
+} );
+
 Object.defineProperties( THREE.ShaderMaterial.prototype, {
 	derivatives: {
 		get: function () {
-			console.warn( 'THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
+			console.warn( 'THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives.' );
 			return this.extensions.derivatives;
 		},
 		set: function ( value ) {

+ 0 - 4
src/materials/MeshPhongMaterial.js

@@ -67,8 +67,6 @@ THREE.MeshPhongMaterial = function ( parameters ) {
 	this.specular = new THREE.Color( 0x111111 );
 	this.shininess = 30;
 
-	this.metal = false;
-
 	this.map = null;
 
 	this.lightMap = null;
@@ -129,8 +127,6 @@ THREE.MeshPhongMaterial.prototype.copy = function ( source ) {
 	this.specular.copy( source.specular );
 	this.shininess = source.shininess;
 
-	this.metal = source.metal;
-
 	this.map = source.map;
 
 	this.lightMap = source.lightMap;

+ 1 - 9
src/renderers/shaders/ShaderLib.js

@@ -395,15 +395,7 @@ THREE.ShaderLib = {
 				"reflectedLight.directDiffuse *= shadowMask;",
 				"reflectedLight.directSpecular *= shadowMask;",
 
-				"#ifdef METAL",
-
-				"   vec3 outgoingLight = ( reflectedLight.directDiffuse + reflectedLight.indirectDiffuse ) * specular + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",
-
-				"#else",
-
-				"   vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",
-
-				"#endif",
+				"vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveLight;",
 
 				THREE.ShaderChunk[ "envmap_fragment" ],
 				THREE.ShaderChunk[ "linear_to_gamma_fragment" ],

+ 0 - 1
src/renderers/webgl/WebGLProgram.js

@@ -391,7 +391,6 @@ THREE.WebGLProgram = ( function () {
 
 				parameters.flatShading ? '#define FLAT_SHADED' : '',
 
-				parameters.metal ? '#define METAL' : '',
 				parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
 				parameters.flipSided ? '#define FLIP_SIDED' : '',
 

+ 1 - 2
src/renderers/webgl/WebGLPrograms.js

@@ -23,7 +23,7 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
 		"maxBones", "useVertexTexture", "morphTargets", "morphNormals",
 		"maxMorphTargets", "maxMorphNormals", "maxDirLights", "maxPointLights",
 		"maxSpotLights", "maxHemiLights", "maxShadows", "shadowMapEnabled", "pointLightShadows",
-		"shadowMapType", "shadowMapDebug", "alphaTest", "metal", "doubleSided",
+		"shadowMapType", "shadowMapDebug", "alphaTest", "doubleSided",
 		"flipSided"
 	];
 
@@ -144,7 +144,6 @@ THREE.WebGLPrograms = function ( renderer, capabilities ) {
 			shadowMapDebug: renderer.shadowMap.debug,
 
 			alphaTest: material.alphaTest,
-			metal: material.metal,
 			doubleSided: material.side === THREE.DoubleSide,
 			flipSided: material.side === THREE.BackSide