|
|
@@ -163,7 +163,6 @@ class CSMShadowNode extends ShadowBaseNode {
|
|
|
this.mainFrustum = new CSMFrustum( data );
|
|
|
|
|
|
const light = this.light;
|
|
|
- const parent = light.parent;
|
|
|
|
|
|
for ( let i = 0; i < this.cascades; i ++ ) {
|
|
|
|
|
|
@@ -175,9 +174,6 @@ class CSMShadowNode extends ShadowBaseNode {
|
|
|
|
|
|
this.lights.push( lwLight );
|
|
|
|
|
|
- parent.add( lwLight );
|
|
|
- parent.add( lwLight.target );
|
|
|
-
|
|
|
lwLight.shadow = lShadow;
|
|
|
|
|
|
this._shadowNodes.push( shadow( lwLight, lShadow ) );
|
|
|
@@ -503,9 +499,26 @@ class CSMShadowNode extends ShadowBaseNode {
|
|
|
updateBefore( /*builder*/ ) {
|
|
|
|
|
|
const light = this.light;
|
|
|
+ const parent = light.parent;
|
|
|
const camera = this.camera;
|
|
|
const frustums = this.frustums;
|
|
|
|
|
|
+ // make sure the placeholder light objects which represent the
|
|
|
+ // multiple cascade shadow casters are part of the scene graph
|
|
|
+
|
|
|
+ for ( let i = 0; i < this.lights.length; i ++ ) {
|
|
|
+
|
|
|
+ const lwLight = this.lights[ i ];
|
|
|
+
|
|
|
+ if ( lwLight.parent === null ) {
|
|
|
+
|
|
|
+ parent.add( lwLight.target );
|
|
|
+ parent.add( lwLight );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
_lightDirection.subVectors( light.target.position, light.position ).normalize();
|
|
|
|
|
|
// for each frustum we need to find its min-max box aligned with the light orientation
|