save tile texture id into map

This commit is contained in:
2024-05-27 13:05:38 -04:00
parent 710eb80bf0
commit dcf6fc5972
8 changed files with 76 additions and 61 deletions

View File

@@ -70,11 +70,24 @@ pub mod prelude {
pub struct Chunk {
pub heights: [f32; Chunk::SIZE * Chunk::SIZE],
pub textures: [[u32; 2]; Chunk::SIZE * Chunk::SIZE],
pub moisture: [f32; Chunk::SIZE * Chunk::SIZE],
pub temperature: [f32; Chunk::SIZE * Chunk::SIZE],
pub chunk_offset: IVec2,
}
impl Default for Chunk {
fn default() -> Self {
Self {
heights: [0.; Chunk::SIZE * Chunk::SIZE],
textures: [[0;2]; Chunk::SIZE * Chunk::SIZE],
moisture: [0.; Chunk::SIZE * Chunk::SIZE],
temperature: [0.; Chunk::SIZE * Chunk::SIZE],
chunk_offset: Default::default(),
}
}
}
impl Chunk {
pub const SIZE: usize = 64;
pub const WORLD_WIDTH: f32 = Chunk::SIZE as f32 * SHORT_DIAGONAL;