veloren/common/src/terrain/mod.rs

48 lines
919 B
Rust
Raw Normal View History

2019-01-02 19:22:01 +00:00
pub mod biome;
pub mod block;
pub mod chonk;
pub mod structure;
2019-01-02 19:22:01 +00:00
2019-01-15 15:13:11 +00:00
// Reexports
pub use self::{biome::BiomeKind, block::Block};
2019-01-15 15:13:11 +00:00
2019-01-02 19:22:01 +00:00
use crate::{
vol::VolSize,
volumes::{chunk::Chunk, vol_map_2d::VolMap2d},
2019-01-02 19:22:01 +00:00
};
use serde_derive::{Deserialize, Serialize};
use vek::*;
2019-01-02 19:22:01 +00:00
2019-01-15 15:13:11 +00:00
// TerrainChunkSize
2019-01-02 19:22:01 +00:00
#[derive(Debug, Clone, Serialize, Deserialize)]
2019-01-15 15:13:11 +00:00
pub struct TerrainChunkSize;
2019-01-02 19:22:01 +00:00
2019-01-15 15:13:11 +00:00
impl VolSize for TerrainChunkSize {
const SIZE: Vec3<u32> = Vec3 {
x: 32,
y: 32,
z: 32,
};
2019-01-02 19:22:01 +00:00
}
2019-01-15 15:13:11 +00:00
// TerrainChunkMeta
2019-01-02 19:22:01 +00:00
#[derive(Debug, Clone, Serialize, Deserialize)]
2019-01-15 15:13:11 +00:00
pub struct TerrainChunkMeta {
2019-01-02 19:22:01 +00:00
biome: BiomeKind,
}
2019-01-15 15:13:11 +00:00
impl TerrainChunkMeta {
pub fn void() -> Self {
Self {
biome: BiomeKind::Void,
}
}
}
// Terrain type aliases
2019-01-02 19:22:01 +00:00
pub type TerrainChunk = chonk::Chonk; //Chunk<Block, TerrainChunkSize, TerrainChunkMeta>;
pub type TerrainMap = VolMap2d<TerrainChunk, TerrainChunkSize>;