Endless world, still some bugs to figure out
This commit is contained in:
@@ -42,19 +42,28 @@ impl WorldGen {
|
||||
* Generate block
|
||||
*/
|
||||
pub fn generate(block_pos: &Vector3<i32>, block: &mut WorldBlock) {
|
||||
if block_pos.z > 32 as i32 { return; }
|
||||
|
||||
let mut rng = rand::thread_rng();
|
||||
let noise = Perlin::new();
|
||||
|
||||
// Generate height map
|
||||
let (map, _max) = WorldGen::gen_height_map(block_pos.x, block_pos.z, &mut rng, &noise);
|
||||
|
||||
|
||||
// Fill
|
||||
for x in 0..block::SIZE {
|
||||
for z in 0..block::SIZE {
|
||||
let h = map[x][z];
|
||||
let mut h = map[x][z];
|
||||
let mut t = 2;
|
||||
|
||||
if block_pos.x == 8 && block_pos.z == 8 {
|
||||
h = 32;
|
||||
t = 3;
|
||||
}
|
||||
|
||||
//let h = 16; // testing
|
||||
for y in 0..h {
|
||||
block.set(Vector3{x, y, z}, 2);
|
||||
block.set(Vector3{x, y, z}, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user