use glm; type ChunkPos = struct { x: i32, z: i32, }; type SectionPos = union { chunk: ChunkPos, struct { ChunkPos, y: i8, }, }; type BlockPos = struct { x: i32, y: i16, z: i32, }; type Dir = enum u8 { WEST, EAST, DOWN, UP, NORTH, SOUTH, }; fn block_section(pos: BlockPos) SectionPos = { return SectionPos { x = pos.x >> 4, y = (pos.y >> 4): i8, z = pos.z >> 4, }; }; fn section_origin(pos: SectionPos) glm::v3 = { return glm::v3_new( pos.x: f32 * 16.0, pos.y: f32 * 16.0, pos.z: f32 * 16.0, ); }; fn block_origin(pos: BlockPos) glm::v3 = { return glm::v3_new(pos.x: f32, pos.y: f32, pos.z: f32); };