@@ -797,10 +797,14 @@ pub fn prepare_lights(
797
797
798
798
let point_light_count = point_lights
799
799
. iter ( )
800
- . filter ( |light| light. 1 . shadows_enabled && light . 1 . spot_light_angles . is_none ( ) )
800
+ . filter ( |light| light. 1 . spot_light_angles . is_none ( ) )
801
801
. count ( ) ;
802
802
803
- let point_light_shadow_maps_count = point_light_count. min ( max_texture_cubes) ;
803
+ let point_light_shadow_maps_count = point_lights
804
+ . iter ( )
805
+ . filter ( |light| light. 1 . shadows_enabled && light. 1 . spot_light_angles . is_none ( ) )
806
+ . count ( )
807
+ . min ( max_texture_cubes) ;
804
808
805
809
let directional_shadow_maps_count = directional_lights
806
810
. iter ( )
@@ -970,7 +974,7 @@ pub fn prepare_lights(
970
974
n_directional_lights : directional_lights. iter ( ) . len ( ) as u32 ,
971
975
// spotlight shadow maps are stored in the directional light array, starting at directional_shadow_maps_count.
972
976
// the spot lights themselves start in the light array at point_light_count. so to go from light
973
- // index to shadow map index, we need to subtract point light shadowmap count and add directional shadowmap count.
977
+ // index to shadow map index, we need to subtract point light count and add directional shadowmap count.
974
978
spot_light_shadowmap_offset : directional_shadow_maps_count as i32
975
979
- point_light_count as i32 ,
976
980
} ;
@@ -1045,7 +1049,7 @@ pub fn prepare_lights(
1045
1049
let spot_view_transform = spot_view_matrix. into ( ) ;
1046
1050
1047
1051
let angle = light. spot_light_angles . expect ( "lights should be sorted so that \
1048
- [point_light_shadow_maps_count..point_light_shadow_maps_count + spot_light_shadow_maps_count] are spot lights") . 1 ;
1052
+ [point_light_count..point_light_count + spot_light_shadow_maps_count] are spot lights") . 1 ;
1049
1053
let spot_projection = spot_light_projection_matrix ( angle) ;
1050
1054
1051
1055
let depth_texture_view =
0 commit comments