Less noisy worldgen

Former-commit-id: f1df6cc5b170db4949e88f11d26b9867056caacd
This commit is contained in:
Joshua Barretto 2019-05-18 00:50:14 +01:00
parent b48b9f0141
commit 5b055f54a5

View File

@ -36,16 +36,16 @@ impl World {
let get_offset = |pos: Vec2<i32>| {
((offset_nz.get(pos.map(|e| e as f64 / 4000.0).into_array()) + 1.0)
* 1000.0) as i32
* 1000.0)
};
let offset_z = get_offset(chunk_pos * Vec2::from(TerrainChunkSize::SIZE).map(|e: u32| e as i32));
let mut chunk = TerrainChunk::new(offset_z, stone, air, TerrainChunkMeta::void());
let mut chunk = TerrainChunk::new(offset_z as i32, stone, air, TerrainChunkMeta::void());
for x in 0..TerrainChunkSize::SIZE.x as i32 {
for y in 0..TerrainChunkSize::SIZE.y as i32 {
for z in offset_z..offset_z + 256 {
for z in offset_z as i32..offset_z as i32 + 256 {
let lpos = Vec3::new(x, y, z);
let wpos = lpos
+ Vec3::from(chunk_pos) * TerrainChunkSize::SIZE.map(|e| e as i32);