pub struct LightProbeGrid {
pub origin: Vec3,
pub cell_size: Vec3,
pub count_x: u32,
pub count_y: u32,
pub count_z: u32,
pub probes: Vec<LightProbe>,
}Expand description
A 3D grid of SH light probes with trilinear interpolation.
Fields§
§origin: Vec3Grid origin (minimum corner).
cell_size: Vec3Grid cell size.
count_x: u32Number of probes along each axis.
count_y: u32§count_z: u32§probes: Vec<LightProbe>Probes stored in a flat array: index = z * (count_x * count_y) + y * count_x + x.
Implementations§
Source§impl LightProbeGrid
impl LightProbeGrid
Sourcepub fn new(
origin: Vec3,
cell_size: Vec3,
count_x: u32,
count_y: u32,
count_z: u32,
) -> Self
pub fn new( origin: Vec3, cell_size: Vec3, count_x: u32, count_y: u32, count_z: u32, ) -> Self
Create a new grid of probes.
Sourcepub fn probe_at(&self, x: u32, y: u32, z: u32) -> Option<&LightProbe>
pub fn probe_at(&self, x: u32, y: u32, z: u32) -> Option<&LightProbe>
Get a reference to the probe at grid coordinates.
Sourcepub fn probe_at_mut(
&mut self,
x: u32,
y: u32,
z: u32,
) -> Option<&mut LightProbe>
pub fn probe_at_mut( &mut self, x: u32, y: u32, z: u32, ) -> Option<&mut LightProbe>
Get a mutable reference to the probe at grid coordinates.
Sourcepub fn sample_irradiance(&self, point: Vec3, normal: Vec3) -> Color
pub fn sample_irradiance(&self, point: Vec3, normal: Vec3) -> Color
Sample irradiance at a world position using trilinear interpolation.
Sourcepub fn probe_count(&self) -> usize
pub fn probe_count(&self) -> usize
Total number of probes.
Sourcepub fn fill_uniform(&mut self, color: Color)
pub fn fill_uniform(&mut self, color: Color)
Mark all probes as valid with a uniform ambient color.
Sourcepub fn fill_sky_ground(&mut self, sky: Color, ground: Color)
pub fn fill_sky_ground(&mut self, sky: Color, ground: Color)
Mark all probes as valid with a sky/ground gradient.
Trait Implementations§
Source§impl Clone for LightProbeGrid
impl Clone for LightProbeGrid
Source§fn clone(&self) -> LightProbeGrid
fn clone(&self) -> LightProbeGrid
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LightProbeGrid
impl RefUnwindSafe for LightProbeGrid
impl Send for LightProbeGrid
impl Sync for LightProbeGrid
impl Unpin for LightProbeGrid
impl UnsafeUnpin for LightProbeGrid
impl UnwindSafe for LightProbeGrid
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.