mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-13 09:26:11 -04:00
minor chunk rendering performance improvements
This commit is contained in:
parent
6fd7f325a8
commit
a3edf41a55
@ -20,10 +20,10 @@ import de.bixilon.minosoft.data.registries.identified.ResourceLocation
|
|||||||
import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
|
import de.bixilon.minosoft.gui.rendering.models.block.state.render.BlockRender
|
||||||
|
|
||||||
open class BlockState(
|
open class BlockState(
|
||||||
val block: Block,
|
@JvmField val block: Block,
|
||||||
val luminance: Int,
|
val luminance: Int,
|
||||||
) {
|
) {
|
||||||
var model: BlockRender? = null
|
@JvmField var model: BlockRender? = null
|
||||||
|
|
||||||
constructor(block: Block, settings: BlockStateSettings) : this(block, settings.luminance)
|
constructor(block: Block, settings: BlockStateSettings) : this(block, settings.luminance)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import de.bixilon.minosoft.protocol.protocol.ProtocolDefinition
|
|||||||
|
|
||||||
class SectionLight(
|
class SectionLight(
|
||||||
val section: ChunkSection,
|
val section: ChunkSection,
|
||||||
var light: ByteArray = ByteArray(ProtocolDefinition.BLOCKS_PER_SECTION), // packed (skyLight: 0xF0, blockLight: 0x0F)
|
@JvmField var light: ByteArray = ByteArray(ProtocolDefinition.BLOCKS_PER_SECTION), // packed (skyLight: 0xF0, blockLight: 0x0F)
|
||||||
) : AbstractSectionLight() {
|
) : AbstractSectionLight() {
|
||||||
|
|
||||||
fun onBlockChange(x: Int, y: Int, z: Int, previous: BlockState?, state: BlockState?) {
|
fun onBlockChange(x: Int, y: Int, z: Int, previous: BlockState?, state: BlockState?) {
|
||||||
|
@ -69,6 +69,16 @@ object FaceCulling {
|
|||||||
return area
|
return area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private inline fun minOf(a: Float, b: Float): Float {
|
||||||
|
if (a < b) return a
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
private inline fun maxOf(a: Float, b: Float): Float {
|
||||||
|
if (a > b) return a
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
private fun FaceProperties.getSideArea(target: FaceProperties): Float {
|
private fun FaceProperties.getSideArea(target: FaceProperties): Float {
|
||||||
val start = start.array
|
val start = start.array
|
||||||
val targetStart = target.start.array
|
val targetStart = target.start.array
|
||||||
|
Loading…
x
Reference in New Issue
Block a user