pub struct LinearKernel {
pub center_weight: f32,
pub weights: [f32; 3],
pub offsets: [f32; 3],
pub n_taps: u8,
}Expand description
A discrete Gaussian kernel re-expressed for bilinear sampling.
The centre tap is sampled on its own; every other pair of adjacent taps is
merged into a single sample placed between them, so the fragment stage runs
1 + 2 * n_taps samples rather than one per kernel entry.
Fields§
§center_weight: f32Weight of the centre tap.
weights: [f32; 3]Merged weight of each tap pair. Only the first n_taps are meaningful.
One side only: the kernel is symmetric, so each entry is applied on both sides of the centre.
offsets: [f32; 3]Fractional offset, in texels from the centre, each tap pair is sampled
at. Only the first n_taps are meaningful.
n_taps: u8How many tap pairs per side are meaningful.
Implementations§
Source§impl LinearKernel
impl LinearKernel
Sourcepub fn new(kernel: &[f32; 13], kernel_size: u8) -> Self
pub fn new(kernel: &[f32; 13], kernel_size: u8) -> Self
The bilinear form of the first kernel_size weights of kernel.
A kernel_size past MAX_KERNEL_SIZE is clamped to it rather than
indexing out of bounds; the decimation plan never produces one, and
clamping keeps that a fact about the plan rather than a precondition on
this function (E17).