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
@ -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 New Issue
Block a user