kubi/src/world/worldgen.rs

25 lines
609 B
Rust
Raw Normal View History

use glam::IVec3;
use super::{
chunk::{BlockData, CHUNK_SIZE},
block::Block
};
pub fn generate_world(position: IVec3, _seed: u32) -> BlockData {
let mut blocks = Box::new([[[Block::Air; CHUNK_SIZE]; CHUNK_SIZE]; CHUNK_SIZE]);
2023-01-25 20:50:38 -06:00
if position.y == -1 {
for x in 0..CHUNK_SIZE {
for z in 0..CHUNK_SIZE {
2023-01-25 20:50:38 -06:00
blocks[x][0][z] = Block::Grass;
}
}
2023-01-25 20:50:38 -06:00
} else {
blocks[0][0][0] = Block::Stone;
blocks[1][0][0] = Block::Stone;
blocks[0][1][0] = Block::Stone;
blocks[0][2][0] = Block::Stone;
blocks[0][0][1] = Block::Stone;
}
//TODO actual world generation
blocks
}