Synvael/crates/shared/src/world.rs

23 lines
859 B
Rust

// SPDX-License-Identifier: AGPL-3.0-only
//! Core data structures representing the voxel world.
//!
//! The module is split by concept: [`BlockId`] material handles, the [`Chunk`] storage forms, chunk-space coordinates in [`ChunkPos`], and precision-safe entity positions in [`EntityPos`]. Each lives in its own submodule and is re-exported here so callers continue to refer to `shared::world::<Type>` regardless of the internal layout.
mod block;
mod chunk;
mod chunk_data;
mod coords;
mod entity;
pub use block::BlockId;
pub use chunk::{Chunk, PalettedChunk};
pub use chunk_data::ChunkData;
pub use coords::ChunkPos;
pub use entity::EntityPos;
/// The size of a chunk along one axis in blocks.
pub const CHUNK_SIZE: usize = 32;
/// The total number of blocks within a single chunk.
pub const CHUNK_VOLUME: usize = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE;