Skip to main content

VsmCascade

Struct VsmCascade 

Source
pub struct VsmCascade { /* private fields */ }
Expand description

Single orthographic directional shadow cascade inside VirtualShadowMap with static page caching.

Implementations§

Source§

impl VsmCascade

Cascade construction, orthographic shadow rasterization, and PCF sampling for VsmCascade.

Source

pub fn new(resolution: usize, half_extent_m: f32) -> Self

Creates a new VsmCascade with resolution x resolution depth storage and half_extent_m world radius.

§Arguments
  • usize - Shadow map edge resolution in texels (>= 32).
  • f32 - World-space half-extent in meters.
§Returns
  • Self - Pre-allocated VSM cascade.
Source

pub fn light_view_proj(&self) -> Mat4

Builds the column-major orthographic light view-projection matrix matching project_world_point for GPU CSM shader lookups.

§Arguments
  • &Self - Cascade reference.
§Returns
  • Mat4 - Column-major light-space orthographic projection matrix mapping world points to [-1, 1] XY and [0, 1] Z.
Source

pub fn project_world_point(&self, world_pos: Vec3) -> (f32, f32, f32)

Projects a world-space point into normalized cascade UV coordinates and linear shadow depth [0.0, 1.0].

§Arguments
  • Vec3 - World-space position to project.
§Returns
  • (f32, f32, f32) - (u_norm, v_norm, depth_norm) where smaller depth_norm is closer to the sun.
Source

pub fn sample_pcf( &self, world_pos: Vec3, normal: Vec3, sun_dir: Vec3, ) -> Option<f32>

Evaluates rotated 16-tap Vogel-disk PCF shadow visibility at world_pos if inside this cascade’s bounds.

§Arguments
  • Vec3 - World-space surface position.
  • Vec3 - Unit outward surface normal for normal-offset acne prevention.
  • Vec3 - Unit vector pointing toward the sun.
§Returns
  • Option<f32> - Visibility in [VSM_SHADOW_FLOOR, 1.0], or None if outside this cascade.
Source§

impl VsmCascade

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_resolution(&self) -> usize

Source

pub fn get_mut_resolution(&mut self) -> &mut usize

Source

pub fn set_resolution(&mut self, val: usize) -> &mut Self

Source

pub fn get_half_extent_m(&self) -> f32

Source

pub fn get_mut_half_extent_m(&mut self) -> &mut f32

Source

pub fn set_half_extent_m(&mut self, val: f32) -> &mut Self

Source

pub fn get_snapped_center(&self) -> Vec3

Source

pub fn get_mut_snapped_center(&mut self) -> &mut Vec3

Source

pub fn set_snapped_center(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_light_right(&self) -> Vec3

Source

pub fn get_mut_light_right(&mut self) -> &mut Vec3

Source

pub fn set_light_right(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_light_up(&self) -> Vec3

Source

pub fn get_mut_light_up(&mut self) -> &mut Vec3

Source

pub fn set_light_up(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_light_forward(&self) -> Vec3

Source

pub fn get_mut_light_forward(&mut self) -> &mut Vec3

Source

pub fn set_light_forward(&mut self, val: Vec3) -> &mut Self

Source

pub fn get_depth_min(&self) -> f32

Source

pub fn get_mut_depth_min(&mut self) -> &mut f32

Source

pub fn set_depth_min(&mut self, val: f32) -> &mut Self

Source

pub fn get_depth_max(&self) -> f32

Source

pub fn get_mut_depth_max(&mut self) -> &mut f32

Source

pub fn set_depth_max(&mut self, val: f32) -> &mut Self

Source

pub fn get_static_valid(&self) -> bool

Source

pub fn get_mut_static_valid(&mut self) -> &mut bool

Source

pub fn set_static_valid(&mut self, val: bool) -> &mut Self

Trait Implementations§

Source§

impl Clone for VsmCascade

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VsmCascade

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for VsmCascade

§

impl Freeze for VsmCascade
where *const u8 is !null: Freeze, PhantomData<f32>: Freeze,

§

impl Move for VsmCascade

§

impl RefUnwindSafe for VsmCascade

§

impl Send for VsmCascade
where RawVecInner: Send,

§

impl Sync for VsmCascade
where RawVecInner: Sync,

§

impl Unpin for VsmCascade
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for VsmCascade

§

impl UnwindSafe for VsmCascade
where RawVecInner: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.