Sfoglia il codice sorgente

Properly honor customDepthMaterial (#25137)

WestLangley 2 anni fa
parent
commit
e4dc4e87c4
1 ha cambiato i file con 19 aggiunte e 19 eliminazioni
  1. 19 19
      src/renderers/webgl/WebGLShadowMap.js

+ 19 - 19
src/renderers/webgl/WebGLShadowMap.js

@@ -240,37 +240,37 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
 
 			result = ( light.isPointLight === true ) ? _distanceMaterial : _depthMaterial;
 
-		}
+			if ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
+				( material.displacementMap && material.displacementScale !== 0 ) ||
+				( material.alphaMap && material.alphaTest > 0 ) ||
+				( material.map && material.alphaTest > 0 ) ) {
 
-		if ( ( _renderer.localClippingEnabled && material.clipShadows === true && Array.isArray( material.clippingPlanes ) && material.clippingPlanes.length !== 0 ) ||
-			( material.displacementMap && material.displacementScale !== 0 ) ||
-			( material.alphaMap && material.alphaTest > 0 ) ||
-			( material.map && material.alphaTest > 0 ) ) {
+				// in this case we need a unique material instance reflecting the
+				// appropriate state
 
-			// in this case we need a unique material instance reflecting the
-			// appropriate state
+				const keyA = result.uuid, keyB = material.uuid;
 
-			const keyA = result.uuid, keyB = material.uuid;
+				let materialsForVariant = _materialCache[ keyA ];
 
-			let materialsForVariant = _materialCache[ keyA ];
+				if ( materialsForVariant === undefined ) {
 
-			if ( materialsForVariant === undefined ) {
+					materialsForVariant = {};
+					_materialCache[ keyA ] = materialsForVariant;
 
-				materialsForVariant = {};
-				_materialCache[ keyA ] = materialsForVariant;
+				}
 
-			}
+				let cachedMaterial = materialsForVariant[ keyB ];
 
-			let cachedMaterial = materialsForVariant[ keyB ];
+				if ( cachedMaterial === undefined ) {
 
-			if ( cachedMaterial === undefined ) {
+					cachedMaterial = result.clone();
+					materialsForVariant[ keyB ] = cachedMaterial;
 
-				cachedMaterial = result.clone();
-				materialsForVariant[ keyB ] = cachedMaterial;
+				}
 
-			}
+				result = cachedMaterial;
 
-			result = cachedMaterial;
+			}
 
 		}