tilemap update is now done once in every 3 frame

This commit is contained in:
minjaesong
2024-08-30 13:55:37 +09:00
parent 85a4c46240
commit d405302c9d
2 changed files with 23 additions and 8 deletions

View File

@@ -264,11 +264,14 @@ internal object BlocksDrawer {
if (doTilemapUpdate) {
wrapCamera()
camTransX = WorldCamera.x fmod TILE_SIZE
camTransY = WorldCamera.y fmod TILE_SIZE
}
else {
camTransX += WorldCamera.deltaX
camTransY += WorldCamera.deltaY
}
camTransX = WorldCamera.x - camX
camTransY = WorldCamera.y - camY
if (doTilemapUpdate) {
// rendering tilemap only updates every three frame
measureDebugTime("Renderer.Tiling*") {
@@ -1176,7 +1179,7 @@ internal object BlocksDrawer {
private val occlusionIntensity = 0.25f // too low value and dark-coloured walls won't darken enough
private val doTilemapUpdate: Boolean
get() = (!world.layerTerrain.ptrDestroyed && App.GLOBAL_RENDER_TIMER % 30 == 0L)
get() = (!world.layerTerrain.ptrDestroyed && App.GLOBAL_RENDER_TIMER % 3 == 0L)
private var camTransX = 0
private var camTransY = 0