Skip to main content

voxel_split

Function voxel_split 

Source
pub fn voxel_split(voxel: IVec3) -> (IVec3, UVec3)
Expand description

Split a grid-local voxel coordinate into (chunk, voxel-in-chunk).

Uses IVec3::div_euclid / IVec3::rem_euclid so negative voxel coordinates round toward -∞: voxel -1 decomposes to (chunk = -1, voxel = CHUNK_SIZE - 1), not (0, -1). The returned voxel-in-chunk is always non-negative, so casting each component as u32 is safe.