chunk rebuilder system

refactoring
This commit is contained in:
2024-05-06 22:26:30 -04:00
parent cd4c9f2acf
commit 58a9f62dca
12 changed files with 195 additions and 41 deletions

View File

@@ -28,6 +28,10 @@ pub fn offset_to_hex(offset: IVec2) -> IVec3 {
return v;
}
pub fn offset_to_index(offset: IVec2, width: usize) -> usize {
return offset.x as usize + offset.y as usize * width;
}
pub fn snap_to_hex_grid(world_pos: Vec3) -> Vec3 {
return offset_to_world(world_to_offset_pos(world_pos), world_pos.y);
}