mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-15 02:15:34 -04:00
occlusion tracer: only store path by axis
Its not possible that 2 different direction on the same axis are stored at the same position. Halves the temporary memory.
This commit is contained in:
parent
01ad5be5f8
commit
81d6647074
@ -40,7 +40,7 @@ class OcclusionTracer(
|
||||
|
||||
private val skip = SectionPositionSet(chunkPosition, viewDistance, minSection, dimension.sections + 2) // TODO: reuse
|
||||
private val visible = SectionPositionSet(chunkPosition, viewDistance, minSection, dimension.sections + 2)
|
||||
private val paths = Array(6) { SectionPositionSet(chunkPosition, viewDistance, minSection, dimension.sections + 2) }
|
||||
private val paths = Array(Axes.VALUES.size) { SectionPositionSet(chunkPosition, viewDistance, minSection, dimension.sections + 2) }
|
||||
|
||||
|
||||
private inline fun isInViewDistance(chunk: Chunk): Boolean {
|
||||
@ -56,14 +56,14 @@ class OcclusionTracer(
|
||||
val position = SectionPosition.of(chunk.position, height)
|
||||
|
||||
if (position in skip) return
|
||||
if (position in paths[direction.ordinal]) return // path from same source direction already taken
|
||||
if (position in paths[direction.axis.ordinal]) return // path from same source direction already taken
|
||||
|
||||
val section = chunk[height]
|
||||
if (!frustum.containsChunkSection(position)) {
|
||||
skip += position
|
||||
return
|
||||
}
|
||||
paths[direction.ordinal] += position
|
||||
paths[direction.axis.ordinal] += position
|
||||
visible += position
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user