Made the edges of the world be empty

Former-commit-id: 51a3315a3b00d28c87c6364d83e32d180f4f8e18
This commit is contained in:
Joshua Barretto 2019-05-19 15:54:37 +01:00
parent 0a12147855
commit 2996e3c8aa

View File

@ -47,13 +47,16 @@ impl World {
* 1000.0)
};
let offset_z = self.sim.get(chunk_pos.map(|e| e as u32))
let offset_z = if let Some(offset_z) = self.sim
.get(chunk_pos.map(|e| e as u32))
.map(|chunk| chunk.alt as i32)
.unwrap_or(0);
{
offset_z as i32
} else {
return TerrainChunk::new(0, air, air, TerrainChunkMeta::void());
};
//get_offset(chunk_pos * Vec2::from(TerrainChunkSize::SIZE).map(|e: u32| e as i32));
let mut chunk = TerrainChunk::new(offset_z as i32, stone, air, TerrainChunkMeta::void());
let mut chunk = TerrainChunk::new(offset_z, stone, air, TerrainChunkMeta::void());
for x in 0..TerrainChunkSize::SIZE.x as i32 {
for y in 0..TerrainChunkSize::SIZE.y as i32 {