pub struct AmbientSystem {
pub ssao_config: SsaoConfig,
pub ssao_kernel: SsaoKernel,
pub ssao_result: Option<SsaoResult>,
pub probe_grid: Option<LightProbeGrid>,
pub reflection_probes: ReflectionProbeManager,
pub ambient_cube: AmbientCube,
pub hemisphere: HemisphereLight,
pub environment_sh: SphericalHarmonics9,
pub ambient_multiplier: f32,
pub ssao_enabled: bool,
pub probes_enabled: bool,
pub reflections_enabled: bool,
}Expand description
Orchestrates all ambient and indirect lighting components.
Fields§
§ssao_config: SsaoConfig§ssao_kernel: SsaoKernel§ssao_result: Option<SsaoResult>§probe_grid: Option<LightProbeGrid>§reflection_probes: ReflectionProbeManager§ambient_cube: AmbientCube§hemisphere: HemisphereLight§environment_sh: SphericalHarmonics9§ambient_multiplier: f32Global ambient multiplier.
ssao_enabled: boolWhether SSAO is enabled.
probes_enabled: boolWhether the light probe grid is enabled.
reflections_enabled: boolWhether reflection probes are enabled.
Implementations§
Source§impl AmbientSystem
impl AmbientSystem
pub fn new() -> Self
Sourcepub fn update_ssao_config(&mut self, config: SsaoConfig)
pub fn update_ssao_config(&mut self, config: SsaoConfig)
Recreate the SSAO kernel when config changes.
Sourcepub fn compute_ssao(
&mut self,
width: u32,
height: u32,
depth_buffer: &[f32],
normal_buffer: &[Vec3],
projection: &Mat4,
)
pub fn compute_ssao( &mut self, width: u32, height: u32, depth_buffer: &[f32], normal_buffer: &[Vec3], projection: &Mat4, )
Compute SSAO for the given depth and normal buffers.
Sourcepub fn ambient_irradiance(&self, point: Vec3, normal: Vec3) -> Color
pub fn ambient_irradiance(&self, point: Vec3, normal: Vec3) -> Color
Compute total ambient irradiance at a world position.
Sourcepub fn sample_reflection(
&self,
point: Vec3,
reflection_dir: Vec3,
roughness: f32,
) -> Color
pub fn sample_reflection( &self, point: Vec3, reflection_dir: Vec3, roughness: f32, ) -> Color
Sample reflection at a world position.
Sourcepub fn setup_probe_grid(
&mut self,
origin: Vec3,
cell_size: Vec3,
count_x: u32,
count_y: u32,
count_z: u32,
)
pub fn setup_probe_grid( &mut self, origin: Vec3, cell_size: Vec3, count_x: u32, count_y: u32, count_z: u32, )
Set up a probe grid for the scene.
Sourcepub fn fill_probes_uniform(&mut self, color: Color)
pub fn fill_probes_uniform(&mut self, color: Color)
Fill the probe grid with a uniform ambient color.
Sourcepub fn fill_probes_sky_ground(&mut self, sky: Color, ground: Color)
pub fn fill_probes_sky_ground(&mut self, sky: Color, ground: Color)
Fill the probe grid with a sky/ground gradient.
Sourcepub fn stats(&self) -> AmbientStats
pub fn stats(&self) -> AmbientStats
Get stats.
Trait Implementations§
Source§impl Debug for AmbientSystem
impl Debug for AmbientSystem
Auto Trait Implementations§
impl Freeze for AmbientSystem
impl RefUnwindSafe for AmbientSystem
impl Send for AmbientSystem
impl Sync for AmbientSystem
impl Unpin for AmbientSystem
impl UnsafeUnpin for AmbientSystem
impl UnwindSafe for AmbientSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.