mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
inline chunk section index functions
* Performance improvement
This commit is contained in:
parent
440c00d29a
commit
e47e60191d
@ -104,13 +104,13 @@ class ChunkSection(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
val Vec3i.index: Int
|
inline val Vec3i.index: Int
|
||||||
get() = getIndex(x, y, z)
|
get() = getIndex(x, y, z)
|
||||||
|
|
||||||
val Int.indexPosition: Vec3i
|
inline val Int.indexPosition: Vec3i
|
||||||
get() = Vec3i(this and 0x0F, (this shr 8) and 0x0F, (this shr 4) and 0x0F)
|
get() = Vec3i(this and 0x0F, (this shr 8) and 0x0F, (this shr 4) and 0x0F)
|
||||||
|
|
||||||
fun getIndex(x: Int, y: Int, z: Int): Int {
|
inline fun getIndex(x: Int, y: Int, z: Int): Int {
|
||||||
return y shl 8 or (z shl 4) or x
|
return y shl 8 or (z shl 4) or x
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user