diff --git a/src/materials/MeshDepthMaterial.js b/src/materials/MeshDepthMaterial.js index a3a4272f8d4a2e3c38950c15b954c36d7fda4cd6..c9785286320cb75ddcccae7922fd72edc19fed43 100644 --- a/src/materials/MeshDepthMaterial.js +++ b/src/materials/MeshDepthMaterial.js @@ -2,10 +2,16 @@ * @author mrdoob / http://mrdoob.com/ * @author alteredq / http://alteredqualia.com/ * @author bhouston / https://clara.io + * @author WestLangley / http://github.com/WestLangley * * parameters = { + * * opacity: , * + * map: new THREE.Texture( ), + * + * alphaMap: new THREE.Texture( ), + * * displacementMap: new THREE.Texture( ), * displacementScale: , * displacementBias: , @@ -26,6 +32,10 @@ THREE.MeshDepthMaterial = function ( parameters ) { this.skinning = false; this.morphTargets = false; + this.map = null; + + this.alphaMap = null; + this.displacementMap = null; this.displacementScale = 1; this.displacementBias = 0; @@ -49,6 +59,10 @@ THREE.MeshDepthMaterial.prototype.copy = function ( source ) { this.skinning = source.skinning; this.morphTargets = source.morphTargets; + this.map = source.map; + + this.alphaMap = source.alphaMap; + this.displacementMap = source.displacementMap; this.displacementScale = source.displacementScale; this.displacementBias = source.displacementBias; diff --git a/src/renderers/WebGLRenderer.js b/src/renderers/WebGLRenderer.js index c10f980e914ed2fc0a3b89fa796a1bf3ec9a2280..1dd67aaf933c135d583119f572bf0e9e2004ea67 100644 --- a/src/renderers/WebGLRenderer.js +++ b/src/renderers/WebGLRenderer.js @@ -1890,7 +1890,8 @@ THREE.WebGLRenderer = function ( parameters ) { if ( material instanceof THREE.MeshBasicMaterial || material instanceof THREE.MeshLambertMaterial || material instanceof THREE.MeshPhongMaterial || - material instanceof THREE.MeshStandardMaterial ) { + material instanceof THREE.MeshStandardMaterial || + material instanceof THREE.MeshDepthMaterial ) { refreshUniformsCommon( m_uniforms, material ); @@ -1929,8 +1930,6 @@ THREE.WebGLRenderer = function ( parameters ) { } else if ( material instanceof THREE.MeshDepthMaterial ) { - m_uniforms.opacity.value = material.opacity; - if ( material.displacementMap ) { m_uniforms.displacementMap.value = material.displacementMap; diff --git a/src/renderers/shaders/ShaderLib.js b/src/renderers/shaders/ShaderLib.js index cd9a3dd19b86d74786c41455fff3277b0f753e05..ccc67ddb3bf4442471a4c3891a048bb2836fadd2 100644 --- a/src/renderers/shaders/ShaderLib.js +++ b/src/renderers/shaders/ShaderLib.js @@ -171,11 +171,8 @@ THREE.ShaderLib = { uniforms: THREE.UniformsUtils.merge( [ - THREE.UniformsLib[ 'displacementmap' ], - - { - "opacity" : { type: "1f", value: 1.0 } - } + THREE.UniformsLib[ 'common' ], + THREE.UniformsLib[ 'displacementmap' ] ] ), diff --git a/src/renderers/shaders/ShaderLib/depth_frag.glsl b/src/renderers/shaders/ShaderLib/depth_frag.glsl index 4928dbb2aa1e64dde06d2712144a231ab7fa0a90..4078a9c68fe797c344fbf49945bede86fb34b8d7 100644 --- a/src/renderers/shaders/ShaderLib/depth_frag.glsl +++ b/src/renderers/shaders/ShaderLib/depth_frag.glsl @@ -6,12 +6,28 @@ #include #include +#include +#include +#include #include #include void main() { #include + + vec4 diffuseColor = vec4( 1.0 ); + + #if DEPTH_PACKING == 3200 + + diffuseColor.a = opacity; + + #endif + + #include + #include + #include + #include #if DEPTH_PACKING == 3200