Bodies of water no longer contain black chunks on the voxel minimap.

The heuristic for pruning dungeon ceilings depended on detecting an
air-to-not-air edge, which was not present for chunks whose topmost
layer was water. Sampling 1 layer of the `above` block introduces such
an edge, allowing the water surface to be detected.
This commit is contained in:
Avi Weinstock 2021-11-29 14:39:56 -05:00
parent 55be707c7b
commit cb4c3eb34e
2 changed files with 3 additions and 2 deletions

View File

@ -55,6 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Many know water generation problems - Many know water generation problems
- Trading over long distances using ghost characters or client-side exploits is no longer possible - Trading over long distances using ghost characters or client-side exploits is no longer possible
- Merchant cost percentages displayed as floored, whole numbers - Merchant cost percentages displayed as floored, whole numbers
- Bodies of water no longer contain black chunks on the voxel minimap.
## [0.11.0] - 2021-09-11 ## [0.11.0] - 2021-09-11

View File

@ -83,7 +83,7 @@ impl VoxelMinimap {
/// Each layer is a slice of the terrain near that z-level /// Each layer is a slice of the terrain near that z-level
fn composite_layer_slice(chunk: &TerrainChunk, layers: &mut Vec<Grid<(Rgba<u8>, bool)>>) { fn composite_layer_slice(chunk: &TerrainChunk, layers: &mut Vec<Grid<(Rgba<u8>, bool)>>) {
for z in chunk.get_min_z()..chunk.get_max_z() { for z in chunk.get_min_z()..=chunk.get_max_z() {
let grid = Grid::populate_from(Vec2::new(32, 32), |v| { let grid = Grid::populate_from(Vec2::new(32, 32), |v| {
let mut rgba = Rgba::<f32>::zero(); let mut rgba = Rgba::<f32>::zero();
let (weights, zoff) = (&[1, 2, 4, 1, 1, 1][..], -2); let (weights, zoff) = (&[1, 2, 4, 1, 1, 1][..], -2);
@ -104,7 +104,7 @@ impl VoxelMinimap {
/// Each layer is the overhead as if its z-level were the ceiling /// Each layer is the overhead as if its z-level were the ceiling
fn composite_layer_overhead(chunk: &TerrainChunk, layers: &mut Vec<Grid<(Rgba<u8>, bool)>>) { fn composite_layer_overhead(chunk: &TerrainChunk, layers: &mut Vec<Grid<(Rgba<u8>, bool)>>) {
for z in chunk.get_min_z()..chunk.get_max_z() { for z in chunk.get_min_z()..=chunk.get_max_z() {
let grid = Grid::populate_from(Vec2::new(32, 32), |v| { let grid = Grid::populate_from(Vec2::new(32, 32), |v| {
let mut rgba = None; let mut rgba = None;