Function ispc_downsampler::downsample_normal_map
source · pub fn downsample_normal_map(
src: &Image<'_>,
target_width: u32,
target_height: u32,
pixel_stride_in_bytes: usize,
normal_map_format: NormalMapFormat
) -> Vec<u8>Expand description
Downsamples an image that is meant to be used as a normal map. Uses a box filter instead of a lanczos filter, and normalizes each pixel to preserve unit length for the normals after downsampling.
Returns a Vec with the downsampled data. If normal_map_format.pixel_size() < pixel_stride_in_bytes, the Vec will contain more values than channels than the format has specified, with all pixels in them initialized to 255.