Переглянути джерело

Fix: breaks not recalculated when num cascades changed

Popov72 5 роки тому
батько
коміт
2e30cbc1ca
1 змінених файлів з 3 додано та 1 видалено
  1. 3 1
      src/Lights/Shadows/cascadedShadowGenerator.ts

+ 3 - 1
src/Lights/Shadows/cascadedShadowGenerator.ts

@@ -688,7 +688,7 @@ export class CascadedShadowGenerator implements IShadowGenerator {
         this._light = light;
         this._mapSize = mapSize;
         light._shadowGenerator = this;
-        this.frustumLength = this._scene.activeCamera?.maxZ ?? 10000;
+        this._frustumLength = this._scene.activeCamera?.maxZ ?? 10000;
 
         CascadedShadowGenerator._SceneComponentInitialization(this._scene);
 
@@ -779,6 +779,8 @@ export class CascadedShadowGenerator implements IShadowGenerator {
             this._light._markMeshesAsLightDirty();
             this.recreateShadowMap();
         });
+
+        this._initCascades();
     }
 
     private _renderForShadowMap(opaqueSubMeshes: SmartArray<SubMesh>, alphaTestSubMeshes: SmartArray<SubMesh>, transparentSubMeshes: SmartArray<SubMesh>, depthOnlySubMeshes: SmartArray<SubMesh>): void {