Explorar el Código

Add Empty Shadow Map Guard

Sebastien Vandenberghe hace 7 años
padre
commit
f1b650f4d1
Se han modificado 1 ficheros con 7 adiciones y 2 borrados
  1. 7 2
      src/Materials/babylon.materialHelper.ts

+ 7 - 2
src/Materials/babylon.materialHelper.ts

@@ -236,8 +236,13 @@ module BABYLON {
                     if (mesh && mesh.receiveShadows && scene.shadowsEnabled && light.shadowEnabled) {
                         var shadowGenerator = light.getShadowGenerator();
                         if (shadowGenerator) {
-                            shadowEnabled = true;
-                            shadowGenerator.prepareDefines(defines, lightIndex);
+                            const shadowMap = shadowGenerator.getShadowMapForRendering();
+                            if (shadowMap) {
+                                if (shadowMap.renderList && shadowMap.renderList.length > 0) {
+                                    shadowEnabled = true;
+                                    shadowGenerator.prepareDefines(defines, lightIndex);
+                                }
+                            }
                         }
                     }