mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 11:58:21 -06:00
chunk structure
This commit is contained in:
parent
706f482f18
commit
2c01480a93
|
@ -1 +1,41 @@
|
|||
pub struct Chunk;
|
||||
use glam::IVec3;
|
||||
use glium::{VertexBuffer, IndexBuffer};
|
||||
use super::block::Block;
|
||||
|
||||
pub const CHUNK_SIZE: usize = 32;
|
||||
|
||||
type ChunkBlockData = Box<[[[Block; CHUNK_SIZE]; CHUNK_SIZE]; CHUNK_SIZE]>;
|
||||
|
||||
pub struct ChunkData {
|
||||
pub blocks: ChunkBlockData,
|
||||
pub has_renderable_blocks: bool,
|
||||
}
|
||||
impl ChunkData {
|
||||
pub fn update_metadata(&mut self) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct ChunkMesh {
|
||||
pub is_dirty: bool,
|
||||
pub vertex_buffer: VertexBuffer<ChunkVertex>,
|
||||
pub index_buffer: IndexBuffer<u32>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub enum ChunkState {
|
||||
ToUnload, //desired only
|
||||
Nothing,
|
||||
Loading, //current only
|
||||
Loaded,
|
||||
Meshing, //current only
|
||||
Rendered
|
||||
}
|
||||
|
||||
pub struct Chunk {
|
||||
pub position: IVec3,
|
||||
pub block_data: Option<ChunkData>,
|
||||
pub mesh: Option<ChunkMesh>,
|
||||
pub current_state: ChunkState,
|
||||
pub desired_state: ChunkState,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue