2019-01-02 19:22:01 +00:00
|
|
|
pub mod biome;
|
2019-04-29 20:37:19 +00:00
|
|
|
pub mod block;
|
2019-05-17 17:44:30 +00:00
|
|
|
pub mod chonk;
|
2019-05-24 11:08:38 +00:00
|
|
|
pub mod structure;
|
2019-01-02 19:22:01 +00:00
|
|
|
|
2019-01-15 15:13:11 +00:00
|
|
|
// Reexports
|
2019-08-14 21:28:37 +00:00
|
|
|
pub use self::{
|
|
|
|
biome::BiomeKind,
|
|
|
|
block::{Block, BlockKind},
|
|
|
|
structure::Structure,
|
|
|
|
};
|
2019-01-15 15:13:11 +00:00
|
|
|
|
2019-06-06 14:48:41 +00:00
|
|
|
use crate::{vol::VolSize, volumes::vol_map_2d::VolMap2d};
|
2019-04-29 20:37:19 +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
|
|
|
|
2019-04-22 00:38:29 +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 {
|
2019-04-29 20:37:19 +00:00
|
|
|
const SIZE: Vec3<u32> = Vec3 {
|
|
|
|
x: 32,
|
|
|
|
y: 32,
|
2019-08-15 00:07:43 +00:00
|
|
|
z: std::i32::MAX as u32,
|
2019-04-29 20:37:19 +00:00
|
|
|
};
|
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
|
|
|
|
2019-04-22 00:38:29 +00:00
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
2019-01-15 15:13:11 +00:00
|
|
|
pub struct TerrainChunkMeta {
|
2019-06-11 18:39:25 +00:00
|
|
|
name: Option<String>,
|
2019-01-02 19:22:01 +00:00
|
|
|
biome: BiomeKind,
|
|
|
|
}
|
|
|
|
|
2019-01-15 15:13:11 +00:00
|
|
|
impl TerrainChunkMeta {
|
2019-06-11 18:39:25 +00:00
|
|
|
pub fn new(name: Option<String>, biome: BiomeKind) -> Self {
|
2019-06-15 10:36:26 +00:00
|
|
|
Self { name, biome }
|
2019-06-11 18:39:25 +00:00
|
|
|
}
|
|
|
|
|
2019-01-15 15:13:11 +00:00
|
|
|
pub fn void() -> Self {
|
|
|
|
Self {
|
2019-06-11 18:39:25 +00:00
|
|
|
name: None,
|
2019-01-15 15:13:11 +00:00
|
|
|
biome: BiomeKind::Void,
|
|
|
|
}
|
|
|
|
}
|
2019-06-11 18:39:25 +00:00
|
|
|
|
|
|
|
pub fn name(&self) -> &str {
|
|
|
|
self.name
|
|
|
|
.as_ref()
|
|
|
|
.map(|s| s.as_str())
|
|
|
|
.unwrap_or("Wilderness")
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn biome(&self) -> BiomeKind {
|
|
|
|
self.biome
|
|
|
|
}
|
2019-01-15 15:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Terrain type aliases
|
2019-01-02 19:22:01 +00:00
|
|
|
|
2019-05-17 17:44:30 +00:00
|
|
|
pub type TerrainChunk = chonk::Chonk; //Chunk<Block, TerrainChunkSize, TerrainChunkMeta>;
|
|
|
|
pub type TerrainMap = VolMap2d<TerrainChunk, TerrainChunkSize>;
|