pub struct SpotLight {
pub position: Vec3,
pub direction: Vec3,
pub color: Vec3,
pub intensity: f32,
pub inner_angle: f32,
pub outer_angle: f32,
}Expand description
Spot light — cone-shaped.
Fields§
§position: Vec3§direction: Vec3Unit direction the spot points toward.
color: Vec3§intensity: f32§inner_angle: f32Inner cone half-angle (full bright region), in radians.
outer_angle: f32Outer cone half-angle (falloff to zero), in radians.
Implementations§
Source§impl SpotLight
impl SpotLight
pub fn new( position: Vec3, direction: Vec3, color: Vec3, intensity: f32, inner_angle: f32, outer_angle: f32, ) -> Self
Sourcepub fn angular_attenuation(&self, surface_pos: Vec3) -> f32
pub fn angular_attenuation(&self, surface_pos: Vec3) -> f32
Angular attenuation — smooth falloff from inner to outer cone.
Sourcepub fn radial_attenuation(&self, surface_pos: Vec3) -> f32
pub fn radial_attenuation(&self, surface_pos: Vec3) -> f32
Radial attenuation (same as point light).
Sourcepub fn irradiance_at(&self, surface_pos: Vec3) -> Vec3
pub fn irradiance_at(&self, surface_pos: Vec3) -> Vec3
Combined irradiance at surface position.
Sourcepub fn direction_to(&self, surface_pos: Vec3) -> Vec3
pub fn direction_to(&self, surface_pos: Vec3) -> Vec3
Direction from surface toward the light source.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SpotLight
impl RefUnwindSafe for SpotLight
impl Send for SpotLight
impl Sync for SpotLight
impl Unpin for SpotLight
impl UnsafeUnpin for SpotLight
impl UnwindSafe for SpotLight
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.