pub struct PcfKernel {
pub offsets: Vec<(f32, f32)>,
pub weights: Vec<f32>,
pub texel_size: f32,
}Expand description
Percentage-closer filtering kernel for soft shadows.
Fields§
§offsets: Vec<(f32, f32)>Sample offsets (in texels).
weights: Vec<f32>Corresponding weights (should sum to 1.0).
texel_size: f32Texel size for the shadow map.
Implementations§
Source§impl PcfKernel
impl PcfKernel
Sourcepub fn kernel_3x3(texel_size: f32) -> Self
pub fn kernel_3x3(texel_size: f32) -> Self
Create a 3x3 PCF kernel.
Sourcepub fn kernel_5x5(texel_size: f32) -> Self
pub fn kernel_5x5(texel_size: f32) -> Self
Create a 5x5 PCF kernel.
Sourcepub fn poisson_disk(sample_count: usize, texel_size: f32) -> Self
pub fn poisson_disk(sample_count: usize, texel_size: f32) -> Self
Create a Poisson disk PCF kernel with the given number of samples.
Sourcepub fn sample(&self, shadow_map: &ShadowMap, world_pos: Vec3, bias: f32) -> f32
pub fn sample(&self, shadow_map: &ShadowMap, world_pos: Vec3, bias: f32) -> f32
Sample the shadow map with PCF filtering. Returns shadow factor (0.0..1.0).
Sourcepub fn sample_atlas(
&self,
atlas: &ShadowAtlas,
region_idx: usize,
u: f32,
v: f32,
depth: f32,
bias: f32,
) -> f32
pub fn sample_atlas( &self, atlas: &ShadowAtlas, region_idx: usize, u: f32, v: f32, depth: f32, bias: f32, ) -> f32
Sample from a shadow atlas region.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PcfKernel
impl RefUnwindSafe for PcfKernel
impl Send for PcfKernel
impl Sync for PcfKernel
impl Unpin for PcfKernel
impl UnsafeUnpin for PcfKernel
impl UnwindSafe for PcfKernel
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