pub struct ShadowSystem {
pub config: ShadowConfig,
pub atlas: ShadowAtlas,
pub cascaded_maps: HashMap<LightId, CascadedShadowMap>,
pub omni_maps: HashMap<LightId, OmniShadowMap>,
pub spot_maps: HashMap<LightId, usize>,
pub pcf_kernel: PcfKernel,
pub vsm_maps: HashMap<LightId, VarianceShadowMap>,
pub stats: ShadowStats,
}Expand description
Top-level shadow system that orchestrates shadow map allocation and rendering.
Fields§
§config: ShadowConfig§atlas: ShadowAtlas§cascaded_maps: HashMap<LightId, CascadedShadowMap>§omni_maps: HashMap<LightId, OmniShadowMap>§spot_maps: HashMap<LightId, usize>§pcf_kernel: PcfKernel§vsm_maps: HashMap<LightId, VarianceShadowMap>§stats: ShadowStatsStats from the last frame.
Implementations§
Source§impl ShadowSystem
impl ShadowSystem
pub fn new(config: ShadowConfig) -> Self
Sourcepub fn allocate_for_lights(&mut self, lights: &[(LightId, &Light)])
pub fn allocate_for_lights(&mut self, lights: &[(LightId, &Light)])
Allocate shadow maps for the given shadow-casting lights.
Sourcepub fn shadow_factor(
&self,
light_id: LightId,
world_pos: Vec3,
normal: Vec3,
view_depth: f32,
) -> f32
pub fn shadow_factor( &self, light_id: LightId, world_pos: Vec3, normal: Vec3, view_depth: f32, ) -> f32
Compute the shadow factor for a world point from a specific light.
Sourcepub fn combined_shadow_factor(
&self,
world_pos: Vec3,
normal: Vec3,
view_depth: f32,
) -> f32
pub fn combined_shadow_factor( &self, world_pos: Vec3, normal: Vec3, view_depth: f32, ) -> f32
Compute combined shadow factor from all shadow-casting lights at a point.
Sourcepub fn stats(&self) -> &ShadowStats
pub fn stats(&self) -> &ShadowStats
Get a reference to the current stats.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ShadowSystem
impl RefUnwindSafe for ShadowSystem
impl Send for ShadowSystem
impl Sync for ShadowSystem
impl Unpin for ShadowSystem
impl UnsafeUnpin for ShadowSystem
impl UnwindSafe for ShadowSystem
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> 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.