pub struct LightManager {
pub ambient_color: Color,
pub ambient_intensity: f32,
/* private fields */
}Expand description
Manages up to 64 simultaneous lights with spatial grid queries.
Fields§
§ambient_color: ColorAmbient light applied everywhere.
ambient_intensity: f32Implementations§
Source§impl LightManager
impl LightManager
pub fn new() -> Self
pub fn with_grid_cell_size(self, size: f32) -> Self
Sourcepub fn add(&mut self, light: Light) -> Option<LightId>
pub fn add(&mut self, light: Light) -> Option<LightId>
Add a light, returning its ID. Returns None if at max capacity.
Sourcepub fn add_point(&mut self, light: PointLight) -> Option<LightId>
pub fn add_point(&mut self, light: PointLight) -> Option<LightId>
Add a point light.
Sourcepub fn add_directional(&mut self, light: DirectionalLight) -> Option<LightId>
pub fn add_directional(&mut self, light: DirectionalLight) -> Option<LightId>
Add a directional light.
Sourcepub fn add_emissive(&mut self, light: EmissiveGlyph) -> Option<LightId>
pub fn add_emissive(&mut self, light: EmissiveGlyph) -> Option<LightId>
Add an emissive glyph light.
Sourcepub fn add_animated(&mut self, light: AnimatedLight) -> Option<LightId>
pub fn add_animated(&mut self, light: AnimatedLight) -> Option<LightId>
Add an animated light.
Sourcepub fn add_ies(&mut self, light: IESProfile) -> Option<LightId>
pub fn add_ies(&mut self, light: IESProfile) -> Option<LightId>
Add an IES profile light.
Sourcepub fn get_mut(&mut self, id: LightId) -> Option<&mut Light>
pub fn get_mut(&mut self, id: LightId) -> Option<&mut Light>
Get a mutable reference to a light by ID.
Sourcepub fn rebuild_grid(&mut self)
pub fn rebuild_grid(&mut self)
Force a rebuild of the spatial grid.
Sourcepub fn lights_at(&mut self, pos: Vec3) -> Vec<LightId>
pub fn lights_at(&mut self, pos: Vec3) -> Vec<LightId>
Query which lights affect a given world position.
Sourcepub fn lights_in_aabb(&mut self, min: Vec3, max: Vec3) -> Vec<LightId>
pub fn lights_in_aabb(&mut self, min: Vec3, max: Vec3) -> Vec<LightId>
Query which lights affect a given AABB.
Sourcepub fn irradiance_at(&mut self, point: Vec3, normal: Vec3) -> Color
pub fn irradiance_at(&mut self, point: Vec3, normal: Vec3) -> Color
Compute total irradiance at a world position from all affecting lights.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get the number of active lights.
Sourcepub fn total_count(&self) -> usize
pub fn total_count(&self) -> usize
Get the total number of lights (active + disabled).
Sourcepub fn most_important_lights(
&mut self,
point: Vec3,
normal: Vec3,
count: usize,
) -> Vec<LightId>
pub fn most_important_lights( &mut self, point: Vec3, normal: Vec3, count: usize, ) -> Vec<LightId>
Get the N most important lights for a given point (sorted by contribution).
Sourcepub fn set_enabled(&mut self, id: LightId, enabled: bool)
pub fn set_enabled(&mut self, id: LightId, enabled: bool)
Enable or disable a light.
Sourcepub fn set_position(&mut self, id: LightId, position: Vec3)
pub fn set_position(&mut self, id: LightId, position: Vec3)
Set the position of a positional light.
Sourcepub fn shadow_casters(&self) -> Vec<(LightId, &Light)>
pub fn shadow_casters(&self) -> Vec<(LightId, &Light)>
Get shadow-casting lights for the shadow system.
Sourcepub fn enabled_lights(&self) -> Vec<(LightId, &Light)>
pub fn enabled_lights(&self) -> Vec<(LightId, &Light)>
Get all enabled lights as a flat list (useful for GPU upload).
Sourcepub fn stats(&self) -> LightManagerStats
pub fn stats(&self) -> LightManagerStats
Get statistics about the light manager.