pub struct VirtualShadowMap { /* private fields */ }Expand description
UE5-style 2-Cascade Virtual Shadow Map with texel-snapped static page caching and 4-tap PCF soft filtering.
Implementations§
Source§impl VirtualShadowMap
Static page cache management and multi-cascade PCF sampling for VirtualShadowMap.
impl VirtualShadowMap
Static page cache management and multi-cascade PCF sampling for VirtualShadowMap.
Sourcepub fn with_resolution(resolution: usize) -> Self
pub fn with_resolution(resolution: usize) -> Self
Sourcepub fn invalidate(&mut self)
pub fn invalidate(&mut self)
Invalidates both static shadow cascades so the next update re-rasterizes static geometry cleanly.
Sourcepub fn update_from_world(&mut self, world: &World3D)
pub fn update_from_world(&mut self, world: &World3D)
Synchronizes both shadow cascades with world, reusing cached static shadow pages whenever sun, static epoch, and snapped cascade centers are unchanged.
§Arguments
&World3D- Active 3D world supplying camera, sun, objects, and mesh library.
Sourcepub fn sample_visibility(
&self,
world_pos: Vec3,
normal: Vec3,
sun_dir: Vec3,
) -> f32
pub fn sample_visibility( &self, world_pos: Vec3, normal: Vec3, sun_dir: Vec3, ) -> f32
Samples multi-cascade 4-tap PCF shadow visibility at world_pos, preferring the high-resolution near cascade and falling back to the far cascade.
§Arguments
Vec3- World-space surface position.Vec3- Unit outward surface normal.Vec3- Unit directional sun vector.
§Returns
f32- Smooth sun visibility in[0.22, 1.0](1.0outside both cascades).
Source§impl VirtualShadowMap
impl VirtualShadowMap
pub fn get_cascade_near(&self) -> &VsmCascade
pub fn get_mut_cascade_near(&mut self) -> &mut VsmCascade
pub fn set_cascade_near(&mut self, val: VsmCascade) -> &mut Self
pub fn get_cascade_far(&self) -> &VsmCascade
pub fn get_mut_cascade_far(&mut self) -> &mut VsmCascade
pub fn set_cascade_far(&mut self, val: VsmCascade) -> &mut Self
pub fn get_cached_sun_dir(&self) -> Vec3
pub fn get_mut_cached_sun_dir(&mut self) -> &mut Vec3
pub fn set_cached_sun_dir(&mut self, val: Vec3) -> &mut Self
pub fn get_cached_static_epoch(&self) -> u64
pub fn get_mut_cached_static_epoch(&mut self) -> &mut u64
pub fn set_cached_static_epoch(&mut self, val: u64) -> &mut Self
pub fn get_static_cache_hits(&self) -> u64
pub fn get_mut_static_cache_hits(&mut self) -> &mut u64
pub fn set_static_cache_hits(&mut self, val: u64) -> &mut Self
pub fn get_static_rebuilds(&self) -> u64
pub fn get_mut_static_rebuilds(&mut self) -> &mut u64
pub fn set_static_rebuilds(&mut self, val: u64) -> &mut Self
Trait Implementations§
Source§impl Clone for VirtualShadowMap
impl Clone for VirtualShadowMap
Source§impl Debug for VirtualShadowMap
impl Debug for VirtualShadowMap
Auto Trait Implementations§
impl Forget for VirtualShadowMap
impl Freeze for VirtualShadowMap
impl Move for VirtualShadowMap
impl RefUnwindSafe for VirtualShadowMap
impl Send for VirtualShadowMapwhere
RawVecInner: Send,
impl Sync for VirtualShadowMapwhere
RawVecInner: Sync,
impl Unpin for VirtualShadowMap
impl UnsafeUnpin for VirtualShadowMap
impl UnwindSafe for VirtualShadowMapwhere
RawVecInner: UnwindSafe,
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