From bccaa60fa9152ad734e2f53dba45585299e8158d Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Wed, 28 Oct 2015 20:18:54 -0400 Subject: [PATCH] MeshPhongMaterial: Removed metal property. Now that we have MeshPhysicalMaterial... --- docs/api/materials/MeshPhongMaterial.html | 7 ------- src/Three.Legacy.js | 14 +++++++++++++- src/materials/MeshPhongMaterial.js | 4 ---- src/renderers/shaders/ShaderLib.js | 10 +--------- src/renderers/webgl/WebGLProgram.js | 1 - src/renderers/webgl/WebGLPrograms.js | 3 +-- 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/docs/api/materials/MeshPhongMaterial.html b/docs/api/materials/MeshPhongMaterial.html index f61c04f2e8..dcfb4ea9e7 100644 --- a/docs/api/materials/MeshPhongMaterial.html +++ b/docs/api/materials/MeshPhongMaterial.html @@ -70,13 +70,6 @@

[property:Float shininess]

How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.
-

[property:boolean metal]

-
- 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. -
-

[property:Texture map]

Set color texture map. Default is null. The texture map color is modulated by the diffuse color.
diff --git a/src/Three.Legacy.js b/src/Three.Legacy.js index 938e68327a..b99f072fac 100644 --- a/src/Three.Legacy.js +++ b/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 ) { diff --git a/src/materials/MeshPhongMaterial.js b/src/materials/MeshPhongMaterial.js index 2940d3a164..94b067cf8e 100644 --- a/src/materials/MeshPhongMaterial.js +++ b/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; diff --git a/src/renderers/shaders/ShaderLib.js b/src/renderers/shaders/ShaderLib.js index ed234c3863..5c5227cd83 100644 --- a/src/renderers/shaders/ShaderLib.js +++ b/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" ], diff --git a/src/renderers/webgl/WebGLProgram.js b/src/renderers/webgl/WebGLProgram.js index ba7acab293..6c768e0390 100644 --- a/src/renderers/webgl/WebGLProgram.js +++ b/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' : '', diff --git a/src/renderers/webgl/WebGLPrograms.js b/src/renderers/webgl/WebGLPrograms.js index bd99ed65c5..eac00e2e4f 100644 --- a/src/renderers/webgl/WebGLPrograms.js +++ b/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 -- GitLab