mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 12:25:12 -04:00
fix flood filling, use correct occlusion camera position
This commit is contained in:
parent
87da02943d
commit
d6cd333ed4
@ -146,24 +146,23 @@ class BlockSectionDataProvider(
|
||||
continue
|
||||
}
|
||||
val regionInt = region.toInt()
|
||||
val override = regionOverride[regionInt]
|
||||
|
||||
if (y < ProtocolDefinition.SECTION_MAX_Y) {
|
||||
val neighbourRegion = regions[(y + 1) shl 8 or (z shl 4) or x]
|
||||
if (neighbourRegion > 0) {
|
||||
regionOverride[regionInt] = neighbourRegion
|
||||
if (neighbourRegion > 0 && region != neighbourRegion) {
|
||||
regionOverride[regionInt] = maxOf(neighbourRegion, region)
|
||||
}
|
||||
}
|
||||
if (z < ProtocolDefinition.SECTION_MAX_Z) {
|
||||
val neighbourRegion = regions[y shl 8 or ((z + 1) shl 4) or x]
|
||||
if (neighbourRegion > 0) {
|
||||
regionOverride[regionInt] = neighbourRegion
|
||||
if (neighbourRegion > 0 && region != neighbourRegion) {
|
||||
regionOverride[regionInt] = maxOf(neighbourRegion, region)
|
||||
}
|
||||
}
|
||||
if (x < ProtocolDefinition.SECTION_MAX_X) {
|
||||
val neighbourRegion = regions[y shl 8 or (z shl 4) or (x + 1)]
|
||||
if (neighbourRegion > 0) {
|
||||
regionOverride[regionInt] = neighbourRegion
|
||||
if (neighbourRegion > 0 && region != neighbourRegion) {
|
||||
regionOverride[regionInt] = maxOf(neighbourRegion, region)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,9 @@ import de.bixilon.minosoft.gui.rendering.modding.events.CameraMatrixChangeEvent
|
||||
import de.bixilon.minosoft.gui.rendering.modding.events.CameraPositionChangeEvent
|
||||
import de.bixilon.minosoft.gui.rendering.modding.events.FrustumChangeEvent
|
||||
import de.bixilon.minosoft.gui.rendering.modding.events.ResizeWindowEvent
|
||||
import de.bixilon.minosoft.gui.rendering.util.VecUtil.blockPosition
|
||||
import de.bixilon.minosoft.gui.rendering.util.VecUtil.chunkPosition
|
||||
import de.bixilon.minosoft.gui.rendering.util.VecUtil.sectionHeight
|
||||
import de.bixilon.minosoft.gui.rendering.util.vec.vec3.Vec3Util.EMPTY
|
||||
import de.bixilon.minosoft.modding.event.invoker.CallbackEventInvoker
|
||||
|
||||
@ -112,7 +115,8 @@ class MatrixHandler(
|
||||
}
|
||||
this.eyePosition = eyePosition
|
||||
this.rotation = rotation
|
||||
camera.visibilityGraph.updateCamera(entity.positionInfo.chunkPosition, entity.positionInfo.sectionHeight)
|
||||
val cameraBlockPosition = eyePosition.blockPosition
|
||||
camera.visibilityGraph.updateCamera(cameraBlockPosition.chunkPosition, cameraBlockPosition.sectionHeight)
|
||||
if (fov != previousFOV || fogEnd != this.fogEnd) {
|
||||
this.fogEnd = fogEnd
|
||||
calculateProjectionMatrix()
|
||||
|
@ -196,7 +196,7 @@ class WorldVisibilityGraph(
|
||||
}
|
||||
}
|
||||
val southIndex = BlockSectionDataProvider.getIndex(inverted, Directions.SOUTH)
|
||||
if (directionVector.z >= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(sectionIndex) != true)) {
|
||||
if (directionVector.z >= 0 && (ignoreVisibility || chunk.sections?.get(sectionIndex)?.blocks?.isOccluded(southIndex) != true)) {
|
||||
val nextPosition = chunkPosition + Directions.SOUTH
|
||||
val nextChunk = chunks[nextPosition]
|
||||
if (nextChunk != null) {
|
||||
@ -267,9 +267,6 @@ class WorldVisibilityGraph(
|
||||
val graph: MutableMap<Vec2i, Array<BooleanArray>> = HashMap()
|
||||
|
||||
for (direction in Directions.VALUES) {
|
||||
if (direction != Directions.DOWN) {
|
||||
continue
|
||||
}
|
||||
val nextPosition = chunkPosition + direction
|
||||
val nextChunk = chunks[nextPosition] ?: continue
|
||||
val nextVisibility = graph.getOrPut(nextPosition) { createVisibilityArray() }
|
||||
|
Loading…
x
Reference in New Issue
Block a user