From 3a83f4e55939f11c75bde0ee96f699987e1d7e73 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Mon, 13 Jun 2022 22:05:10 +0200 Subject: [PATCH] occlusion culling: don't make neighbours of neighbours force visible --- .../gui/rendering/world/view/WorldVisibilityGraph.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/world/view/WorldVisibilityGraph.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/world/view/WorldVisibilityGraph.kt index 8a17e86c8..15dd4c39d 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/world/view/WorldVisibilityGraph.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/world/view/WorldVisibilityGraph.kt @@ -233,7 +233,7 @@ class WorldVisibilityGraph( return } - if (directionVector.x <= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.WEST) != true)) { + if (directionVector.x <= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.WEST) != true)) { val nextPosition = chunkPosition + Directions.WEST val nextChunk = getChunk(nextPosition) if (nextChunk != null) { @@ -245,7 +245,7 @@ class WorldVisibilityGraph( } } - if (directionVector.x >= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.EAST) != true)) { + if (directionVector.x >= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.EAST) != true)) { val nextPosition = chunkPosition + Directions.EAST val nextChunk = getChunk(nextPosition) if (nextChunk != null) { @@ -257,20 +257,20 @@ class WorldVisibilityGraph( } } - if (sectionIndex > 0 && directionVector.y <= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.DOWN) != true)) { + if (sectionIndex > 0 && directionVector.y <= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.DOWN) != true)) { if (!visibilities[sectionIndex - 1]) { visibilities[sectionIndex - 1] = true checkSection(graph, chunkPosition, sectionIndex - 1, chunk, visibilities, Directions.DOWN, directionVector.modify(1, -1), nextStep, false) } } - if (sectionIndex < maxIndex && directionVector.y >= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.UP) != true)) { + if (sectionIndex < maxIndex && directionVector.y >= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.UP) != true)) { if (!visibilities[sectionIndex + 1]) { visibilities[sectionIndex + 1] = true checkSection(graph, chunkPosition, sectionIndex + 1, chunk, visibilities, Directions.UP, directionVector.modify(1, 1), nextStep, false) } } - if (directionVector.z <= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.NORTH) != true)) { + if (directionVector.z <= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.NORTH) != true)) { val nextPosition = chunkPosition + Directions.NORTH val nextChunk = getChunk(nextPosition) if (nextChunk != null) { @@ -282,7 +282,7 @@ class WorldVisibilityGraph( } } - if (directionVector.z >= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.SOUTH) != true)) { + if (directionVector.z >= 0 && (chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(inverted, Directions.SOUTH) != true)) { val nextPosition = chunkPosition + Directions.SOUTH val nextChunk = getChunk(nextPosition) if (nextChunk != null) {