Skip to main content

pack_normals

Function pack_normals 

Source
pub fn pack_normals(
    corners: [Vector3; 3],
    dirs: &[Vector3],
    height: &[f32],
    tile_res: u32,
    over: Option<&[Vector3]>,
) -> Vec<u8> 
Expand description

Pack a chunk’s rgba8 world normals: each texel uses over[i] when the builder supplied one, else a curvature-correct finite difference of the height grid — the same construction NoiseProvider uses (the chunk’s edge vectors are projected perpendicular to the radial direction before the height gradient is added along it).

corners are the chunk’s UNNORMALIZED corners (their length carries the world radius scale); dirs is chunk_dirs for the same chunk.