Skip to content

Commit

Permalink
bevy_pbr: Do not panic when more than 256 point lights are added to t…
Browse files Browse the repository at this point in the history
…he scene
  • Loading branch information
superdump committed Jan 16, 2022
1 parent e30199f commit 8d7d626
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ pub fn prepare_lights(
}

let mut gpu_point_lights = [GpuPointLight::default(); MAX_POINT_LIGHTS];
for (index, &(entity, light)) in point_lights.iter().enumerate() {
for (index, &(entity, light)) in point_lights.iter().enumerate().take(MAX_POINT_LIGHTS) {
let mut flags = PointLightFlags::NONE;
// Lights are sorted, shadow enabled lights are first
if light.shadows_enabled && index < MAX_POINT_LIGHT_SHADOW_MAPS {
Expand Down

0 comments on commit 8d7d626

Please sign in to comment.