diff --git a/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl b/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl index a23f64ed8401a6ea9cbcc8b351491fa8c6691490..d1e4171c9b86f6c3a4535ba0ca5c36ee8174fac5 100644 --- a/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl +++ b/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl @@ -1,10 +1,16 @@ #ifdef USE_SHADOWMAP - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + #if NUM_DIR_LIGHTS > 0 - vDirectionalShadowCoord[ i ] = directionalLights[ i ].shadowMatrix * worldPosition; + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - } + vDirectionalShadowCoord[ i ] = directionalLights[ i ].shadowMatrix * worldPosition; + + } + + #endif + + #if NUM_SPOT_LIGHTS > 0 for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { @@ -12,10 +18,16 @@ } + #endif + + #if NUM_POINT_LIGHTS > 0 + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { vPointShadowCoord[ i ] = pointLights[ i ].shadowMatrix * worldPosition; } + #endif + #endif