Prechádzať zdrojové kódy

Test shadowMap before push in renderTargets

Error when the shadowGenerator is dispose, the renderTargets doesn't have to push the shadow map.
The shadow map has to be test before push in the renderTargets list.
Clément Levasseur 11 rokov pred
rodič
commit
4c6746ba5e
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      Babylon/babylon.scene.js

+ 2 - 2
Babylon/babylon.scene.js

@@ -760,7 +760,7 @@ var BABYLON = BABYLON || {};
             var light = this.lights[lightIndex];
             var shadowGenerator = light.getShadowGenerator();
 
-            if (light.isEnabled() && shadowGenerator) {
+            if (light.isEnabled() && shadowGenerator && shadowGenerator.getShadowMap()._scene.textures.indexOf(shadowGenerator.getShadowMap()) !== -1) {
                 this._renderTargets.push(shadowGenerator.getShadowMap());
             }
         }
@@ -1088,4 +1088,4 @@ var BABYLON = BABYLON || {};
     BABYLON.Scene.FOGMODE_EXP = 1;
     BABYLON.Scene.FOGMODE_EXP2 = 2;
     BABYLON.Scene.FOGMODE_LINEAR = 3;
-})();
+})();