Implement removing a light from the scene
ci/woodpecker/push/build Pipeline was successful Details

This commit is contained in:
SeanOMik 2023-11-10 18:10:00 -05:00
parent aa79ace401
commit da1cac1bff
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
1 changed files with 10 additions and 5 deletions

View File

@ -71,12 +71,17 @@ impl<U: Default + bytemuck::Pod + bytemuck::Zeroable> LightBuffer<U> {
}
}
pub fn remove_light(&mut self, queue: &wgpu::Queue, entity: edict::EntityId) {
todo!() // TODO
}
/// Remove a caster from the buffer, returns true if it was removed.
pub fn remove_light(&mut self, lights_buffer: &mut [U; MAX_LIGHT_COUNT], entity: edict::EntityId) -> bool {
if let Some(removed_idx) = self.used_indexes.remove(&entity) {
self.dead_indexes.push_back(removed_idx);
self.current_count -= 1;
lights_buffer[removed_idx] = U::default();
pub fn prune_dead_lights(&mut self, queue: &wgpu::Queue, entity: edict::EntityId) {
todo!() // TODO
true
} else {
false
}
}
}