pub struct OmniShadowMap {
pub faces: [ShadowMap; 6],
pub light_position: Vec3,
pub radius: f32,
pub resolution: u32,
}Expand description
Shadow map for point lights using a 6-face cubemap layout.
Fields§
§faces: [ShadowMap; 6]Six shadow map faces: +X, -X, +Y, -Y, +Z, -Z.
light_position: Vec3The light’s position.
radius: f32The light’s radius (far plane).
resolution: u32Resolution per face.
Implementations§
Source§impl OmniShadowMap
impl OmniShadowMap
pub fn new(resolution: u32, light_position: Vec3, radius: f32) -> Self
Sourcepub fn update_matrices(&mut self)
pub fn update_matrices(&mut self)
Recompute the view-projection matrices for all six faces.
Sourcepub fn set_position(&mut self, pos: Vec3)
pub fn set_position(&mut self, pos: Vec3)
Update the light position and recompute matrices.
Sourcepub fn select_face(direction: Vec3) -> CubeFace
pub fn select_face(direction: Vec3) -> CubeFace
Determine which cube face a direction vector maps to.
Sourcepub fn is_in_shadow(&self, world_pos: Vec3, bias: f32) -> bool
pub fn is_in_shadow(&self, world_pos: Vec3, bias: f32) -> bool
Test if a world-space point is in shadow.
Sourcepub fn shadow_factor_pcf(
&self,
world_pos: Vec3,
bias: f32,
kernel: &PcfKernel,
) -> f32
pub fn shadow_factor_pcf( &self, world_pos: Vec3, bias: f32, kernel: &PcfKernel, ) -> f32
Compute shadow factor (0.0 = shadowed, 1.0 = lit) with PCF.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Get total memory usage.
Trait Implementations§
Source§impl Clone for OmniShadowMap
impl Clone for OmniShadowMap
Source§fn clone(&self) -> OmniShadowMap
fn clone(&self) -> OmniShadowMap
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 OmniShadowMap
impl RefUnwindSafe for OmniShadowMap
impl Send for OmniShadowMap
impl Sync for OmniShadowMap
impl Unpin for OmniShadowMap
impl UnsafeUnpin for OmniShadowMap
impl UnwindSafe for OmniShadowMap
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.