pub struct AmbientCube {
pub positive_x: Color,
pub negative_x: Color,
pub positive_y: Color,
pub negative_y: Color,
pub positive_z: Color,
pub negative_z: Color,
}Expand description
A 6-directional ambient cube encoding low-frequency lighting from the six axis directions. Simpler than SH but can capture more directional variation than a single ambient color.
Fields§
§positive_x: ColorColor contribution from the +X direction.
negative_x: ColorColor contribution from the -X direction.
positive_y: ColorColor contribution from the +Y direction (up).
negative_y: ColorColor contribution from the -Y direction (down).
positive_z: ColorColor contribution from the +Z direction.
negative_z: ColorColor contribution from the -Z direction.
Implementations§
Source§impl AmbientCube
impl AmbientCube
pub fn new( px: Color, nx: Color, py: Color, ny: Color, pz: Color, nz: Color, ) -> Self
Sourcepub fn from_sky_ground(sky: Color, ground: Color) -> Self
pub fn from_sky_ground(sky: Color, ground: Color) -> Self
Create from sky (up) and ground (down) colors with interpolation for sides.
Sourcepub fn evaluate(&self, normal: Vec3) -> Color
pub fn evaluate(&self, normal: Vec3) -> Color
Evaluate the ambient color for a given normal direction.
Sourcepub fn lerp(&self, other: &Self, t: f32) -> Self
pub fn lerp(&self, other: &Self, t: f32) -> Self
Linearly interpolate between two ambient cubes.
Sourcepub fn to_sh(&self) -> SphericalHarmonics9
pub fn to_sh(&self) -> SphericalHarmonics9
Convert to spherical harmonics (L=1 approximation).
Trait Implementations§
Source§impl Clone for AmbientCube
impl Clone for AmbientCube
Source§fn clone(&self) -> AmbientCube
fn clone(&self) -> AmbientCube
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 moreSource§impl Debug for AmbientCube
impl Debug for AmbientCube
Auto Trait Implementations§
impl Freeze for AmbientCube
impl RefUnwindSafe for AmbientCube
impl Send for AmbientCube
impl Sync for AmbientCube
impl Unpin for AmbientCube
impl UnsafeUnpin for AmbientCube
impl UnwindSafe for AmbientCube
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.