1
0
Эх сурвалжийг харах

WebGPURenderer: Support to dynamic `light.castShadow` (#28945)

* fix name

* support to dynamic light.castShadow
sunag 2 жил өмнө
parent
commit
e275bcf2f3

+ 4 - 6
src/nodes/lighting/AnalyticLightNode.js

@@ -158,15 +158,15 @@ class AnalyticLightNode extends LightingNode {
 
 			//
 
-			const filterFuncion = shadow.filterNode || shadowFilterLib[ renderer.shadowMap.type ] || null;
+			const filterFn = shadow.filterNode || shadowFilterLib[ renderer.shadowMap.type ] || null;
 
-			if ( filterFuncion === null ) {
+			if ( filterFn === null ) {
 
 				throw new Error( 'THREE.WebGPURenderer: Shadow map type not supported yet.' );
 
 			}
 
-			const shadowNode = frustumTest.cond( filterFuncion( { depthTexture, shadowCoord, shadow } ), float( 1 ) );
+			const shadowNode = frustumTest.cond( filterFn( { depthTexture, shadowCoord, shadow } ), float( 1 ) );
 
 			this.shadowMap = shadowMap;
 
@@ -258,9 +258,7 @@ class AnalyticLightNode extends LightingNode {
 
 	updateBefore( frame ) {
 
-		const { light } = this;
-
-		if ( light.castShadow ) this.updateShadow( frame );
+		this.updateShadow( frame );
 
 	}
 

+ 1 - 1
src/renderers/common/nodes/Nodes.js

@@ -226,7 +226,7 @@ class Nodes extends DataMap {
 
 			const cacheKey = [];
 
-			if ( lightsNode ) cacheKey.push( lightsNode.getCacheKey() );
+			if ( lightsNode ) cacheKey.push( lightsNode.getCacheKey( true ) );
 			if ( environmentNode ) cacheKey.push( environmentNode.getCacheKey() );
 			if ( fogNode ) cacheKey.push( fogNode.getCacheKey() );
 

粤ICP备19079148号