Simplify block gen code path when all corners are empty

This commit is contained in:
Jarrod Doyle 2023-05-13 11:51:14 +01:00
parent 2f99b0ea4e
commit a29b4979ef
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 20 additions and 16 deletions

View File

@ -39,10 +39,13 @@ impl Chunk {
}
}
// If all the corners are negative, then all the interpolated values
// will be negative too. In that case we can just fill with empty.
if block_sign == -8.0 {
block.resize(512, Voxel::Empty);
} else {
let mut vals = [0.0f32; 512];
if block_sign != -8.0 {
math::tri_lerp_block(&noise_vals, &[8, 8, 8], &mut vals);
}
let mut idx = 0;
for z in 0..8 {
@ -63,6 +66,7 @@ impl Chunk {
}
}
}
}
block.to_owned()
}