organization and buidings db

This commit is contained in:
2024-06-04 09:18:31 -04:00
parent ee0b17f4b6
commit c31c2fb908
21 changed files with 453 additions and 348 deletions

View File

@@ -0,0 +1,24 @@
use crate::hex_utils::HexCoord;
use super::chunk::Chunk;
pub struct MeshChunkData {
pub heights: [f32; Chunk::AREA],
pub textures: [[u32; 2]; Chunk::AREA],
}
impl MeshChunkData {
pub fn get_neighbors(&self, coord: &HexCoord) -> [f32; 6] {
let mut data = [0.; 6];
let n_tiles = coord.get_neighbors();
for i in 0..6 {
let n = n_tiles[i];
if !n.is_in_bounds(Chunk::SIZE, Chunk::SIZE) {
continue;
}
data[i] = self.heights[n.to_index(Chunk::SIZE)];
}
return data;
}
}