File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change 7171 dirLight . shadow . mapSize . height = 2048 ;
7272 dirLight . shadow . radius = 4 ;
7373 dirLight . shadow . bias = - 0.0005 ;
74+
75+ dirLight . shadow . autoUpdate = false ;
76+ dirLight . shadow . needsUpdate = true ;
77+
7478 scene . add ( dirLight ) ;
7579
7680 //
Original file line number Diff line number Diff line change @@ -267,6 +267,10 @@ class AnalyticLightNode extends LightingNode {
267267 const { shadowMap, light } = this ;
268268 const { renderer, scene, camera } = frame ;
269269
270+
271+ const depthVersion = shadowMap . depthTexture . version ;
272+ this . _depthVersionCached = depthVersion ;
273+
270274 const currentOverrideMaterial = scene . overrideMaterial ;
271275
272276 scene . overrideMaterial = overrideMaterial ;
@@ -315,7 +319,21 @@ class AnalyticLightNode extends LightingNode {
315319
316320 updateBefore ( frame ) {
317321
318- this . updateShadow ( frame ) ;
322+ const shadow = this . light . shadow ;
323+
324+ const needsUpdate = shadow . needsUpdate || shadow . autoUpdate ;
325+
326+ if ( needsUpdate ) {
327+
328+ this . updateShadow ( frame ) ;
329+
330+ if ( this . shadowMap . depthTexture . version === this . _depthVersionCached ) {
331+
332+ shadow . needsUpdate = false ;
333+
334+ }
335+
336+ }
319337
320338 }
321339
You can’t perform that action at this time.
0 commit comments