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
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.