mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 10:55:01 -04:00
improve VoxelSide performance
This commit is contained in:
parent
07b4dda428
commit
775c6b3cfa
@ -18,6 +18,7 @@ import de.bixilon.minosoft.data.direction.Directions
|
||||
import de.bixilon.minosoft.data.registries.shapes.VoxelShape
|
||||
import de.bixilon.minosoft.data.registries.shapes.side.VoxelSide
|
||||
import de.bixilon.minosoft.data.registries.shapes.side.VoxelSideSet
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
|
||||
|
||||
class DirectedProperty(
|
||||
private val directions: BooleanArray,
|
||||
@ -72,7 +73,7 @@ class DirectedProperty(
|
||||
// ToDo: This whole calculation is technically wrong, it could be that 2 different sides of 2 blocks are "free". That means that light can still not pass the blocks, but
|
||||
// this algorithm does not cover it. Let's see it as performance hack
|
||||
|
||||
val sides: MutableSet<VoxelSide> = mutableSetOf()
|
||||
val sides: MutableSet<VoxelSide> = ObjectOpenHashSet()
|
||||
|
||||
for (aabb in this) {
|
||||
when (side.axis) {
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
package de.bixilon.minosoft.data.registries.shapes.side
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet
|
||||
|
||||
class VoxelSideSet(
|
||||
val sides: Set<VoxelSide>,
|
||||
) : Iterable<VoxelSide> {
|
||||
@ -28,7 +30,7 @@ class VoxelSideSet(
|
||||
return this
|
||||
}
|
||||
|
||||
val next: MutableSet<VoxelSide> = mutableSetOf()
|
||||
val next: MutableSet<VoxelSide> = ObjectOpenHashSet()
|
||||
|
||||
val array = this.sides.toTypedArray()
|
||||
for (i in 1 until sides.size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user