Dynamic loading, saving, generating chunks works

This commit is contained in:
Piotrek
2021-05-13 09:13:43 +02:00
parent ab9f4c83d0
commit 57782a88ab
7 changed files with 73 additions and 55 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
use cgmath::Point3;
use cgmath::Vector3;
use noise::{Perlin, NoiseFn};
use rand::{Rng, prelude::ThreadRng};
@@ -39,7 +39,7 @@ impl WorldGen {
/*
* Generate block
*/
pub fn generate(block_pos: &Point3<i32>, block: &mut WorldBlock) {
pub fn generate(block_pos: &Vector3<i32>, block: &mut WorldBlock) {
let mut rng = rand::thread_rng();
let noise = Perlin::new();
@@ -52,7 +52,7 @@ impl WorldGen {
let h = map[x][z];
//let h = 16; // testing
for y in 0..h {
block.set(Point3{x, y, z}, 2);
block.set(Vector3{x, y, z}, 2);
}
}
}