mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
bevy_pbr: Do not panic when more than 256 point lights are added the scene (#3697)
# Objective - Do not panic when mroe than 256 point lights are added the scene - Fixes https://github.com/bevyengine/bevy/issues/3682 ## Solution - Only iterate the first `MAX_POINT_LIGHTS` lights instead of as many as there are ## Open questions - Should we warn that there are more than the maximum allowed number of point lights in the scene?
This commit is contained in:
parent
ef823d369f
commit
a9f2817c49
1 changed files with 1 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue