Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Despawn unused light-view entity #15902

Merged
merged 6 commits into from
Oct 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add doc-string
akimakinai committed Oct 14, 2024
commit 74e09c8031b9473f808da20401d82b8478b05197
3 changes: 3 additions & 0 deletions crates/bevy_pbr/src/render/light.rs
Original file line number Diff line number Diff line change
@@ -459,6 +459,8 @@ fn create_render_visible_mesh_entities(
}

#[derive(Component, Default, Deref, DerefMut)]
/// Component automatically attached to a light entity to track light-view entities
/// for each view.
pub struct LightViewEntities(EntityHashMap<Vec<Entity>>);

// TODO: using required component
@@ -1386,6 +1388,7 @@ pub fn prepare_lights(
));
}

// Despawn light-view entities for views that no longer exist
for mut entities in &mut light_view_entities {
for (_, light_view_entities) in
entities.extract_if(|entity, _| !live_views.contains(entity))