Explorar o código

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 %!s(int64=11) %!d(string=hai) anos
pai
achega
4c6746ba5e
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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;
-})();
+})();