mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-19 04:15:14 -04:00
light engine: micro optimisations…
This commit is contained in:
parent
211dcf84f4
commit
47ccaa0613
@ -533,7 +533,7 @@ class Chunk(
|
|||||||
if (x < ProtocolDefinition.SECTION_MAX_X) {
|
if (x < ProtocolDefinition.SECTION_MAX_X) {
|
||||||
skylightHeightmap[heightmapIndex + 1]
|
skylightHeightmap[heightmapIndex + 1]
|
||||||
} else {
|
} else {
|
||||||
neighbours[ChunkNeighbours.WEST].skylightHeightmap[((z shl 4) or 0)]
|
neighbours[ChunkNeighbours.WEST].skylightHeightmap[(z shl 4) or 0]
|
||||||
},
|
},
|
||||||
|
|
||||||
if (z > 0) {
|
if (z > 0) {
|
||||||
@ -569,7 +569,7 @@ class Chunk(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMaxHeight(x: Int, z: Int): Int {
|
inline fun getMaxHeight(x: Int, z: Int): Int {
|
||||||
return skylightHeightmap[(z shl 4) or x]
|
return skylightHeightmap[(z shl 4) or x]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,11 +264,14 @@ class SectionLight(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val lightProperties = section.blocks.unsafeGet(index)?.lightProperties ?: TransparentProperty
|
var lightProperties = section.blocks.unsafeGet(index)?.lightProperties
|
||||||
|
|
||||||
if (!lightProperties.propagatesLight) {
|
if (lightProperties == null) {
|
||||||
|
lightProperties = TransparentProperty
|
||||||
|
} else if (!lightProperties.propagatesLight) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.light[index] = ((currentLight and BLOCK_LIGHT_MASK) or (nextLevel shl 4)).toByte()
|
this.light[index] = ((currentLight and BLOCK_LIGHT_MASK) or (nextLevel shl 4)).toByte()
|
||||||
|
|
||||||
val neighbours = this.section.neighbours ?: return
|
val neighbours = this.section.neighbours ?: return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user