pub struct Light {
pub direction: Vec3,
pub ambient: f32,
pub shadows: bool,
pub size: f32,
}Expand description
A light from one direction, with an even part that reaches every side.
Fields§
§direction: Vec3The direction the light travels, in scene space.
ambient: f32How bright a surface the light does not reach is, from 0 to 1: the side of a lit surface turned away from the light, and any surface in shadow.
shadows: boolWhether the surfaces that cast shadows cast them on the scene’s surfaces.
size: f32The angle the light spans as the scene sees it, in radians: 0 for a point far away, whose shadows have hard edges. A light of some size casts shadows that are sharp where a caster meets a surface and soft farther from it, as the sun’s 0.0093 does and a wide lamp’s more.
Implementations§
Source§impl Light
impl Light
Sourcepub fn brightness(&self, normal: Vec3) -> f32
pub fn brightness(&self, normal: Vec3) -> f32
How bright a surface is, from ambient to 1, where its side that
faces the viewer has normal: the light reaches only a side that
faces it.
Sourcepub fn shadow_projection<'a>(
&self,
casters: impl IntoIterator<Item = &'a MeshSurface>,
receivers: impl IntoIterator<Item = &'a MeshSurface>,
_: (&Camera, Size),
) -> Option<Mat4>
pub fn shadow_projection<'a>( &self, casters: impl IntoIterator<Item = &'a MeshSurface>, receivers: impl IntoIterator<Item = &'a MeshSurface>, _: (&Camera, Size), ) -> Option<Mat4>
The map from scene space to a shadow map of this light that holds
the shadows casters cast on the part of receivers that camera
shows in bounds of size. x and y run from -1 to 1 across the part
of the light where casters and that part overlap, with room for the
softest penumbra; depth runs from 0 at the caster nearest the light
to 1 at the farthest receiver the camera shows. A point farther along
the light than a caster’s depth there lies in its shadow. None when
no caster overlaps a receiver the camera shows, or for a light with
no direction.
Trait Implementations§
impl Copy for Light
impl StructuralPartialEq for Light
Auto Trait Implementations§
impl Forget for Light
impl Freeze for Light
impl Move for Light
impl RefUnwindSafe for Light
impl Send for Light
impl Sync for Light
impl Unpin for Light
impl UnsafeUnpin for Light
impl UnwindSafe for Light
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more