mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
wire actors to only update when wire change queue is not empty
This commit is contained in:
@@ -22,7 +22,7 @@ object ReferencingRanges {
|
||||
// IDs doesn't effect the render order at all, but we're kinda enforcing these ID ranging.
|
||||
// However, these two wire-related actor will break the rule. But as we want them to render on top of others
|
||||
// in the same render orders, we're giveng them relatively high IDs for them.
|
||||
val ACTORS_WIRES = 0x7FFF_E000..0x7FFF_EFFF // Rendered front--wires
|
||||
val ACTORS_WIRES = 0x7FFF_C000..0x7FFF_EFFF // Rendered front--wires
|
||||
val ACTORS_WIRES_HELPER = 0x7FFF_F000..0x7FFF_FF00 // Rendered overlay--wiring port icons and logic gates
|
||||
|
||||
val ACTORS_OVERLAY = 0x7001_0000..0x7FFE_FFFF // Rendered as screen overlay, not affected by light nor environment overlays
|
||||
|
||||
@@ -6,8 +6,7 @@ import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.measureDebugTime
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.AppLoader.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.blockproperties.BlockPropUtil
|
||||
@@ -188,6 +187,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
private set
|
||||
|
||||
var selectedWireRenderClass = ""
|
||||
private var oldSelectedWireRenderClass = ""
|
||||
|
||||
|
||||
|
||||
@@ -539,16 +539,16 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
var i = 0L
|
||||
while (updateAkku >= updateRate) {
|
||||
AppLoader.measureDebugTime("Ingame.Update") { updateGame(updateRate) }
|
||||
measureDebugTime("Ingame.Update") { updateGame(updateRate) }
|
||||
updateAkku -= updateRate
|
||||
i += 1
|
||||
}
|
||||
AppLoader.setDebugTime("Ingame.UpdateCounter", i)
|
||||
setDebugTime("Ingame.UpdateCounter", i)
|
||||
|
||||
|
||||
|
||||
/** RENDER CODE GOES HERE */
|
||||
AppLoader.measureDebugTime("Ingame.Render") { renderGame() }
|
||||
measureDebugTime("Ingame.Render") { renderGame() }
|
||||
|
||||
}
|
||||
|
||||
@@ -579,16 +579,23 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
///////////////////////////
|
||||
BlockPropUtil.dynamicLumFuncTickClock()
|
||||
world.updateWorldTime(delta)
|
||||
AppLoader.measureDebugTime("WorldSimulator.update") {
|
||||
measureDebugTime("WorldSimulator.update") {
|
||||
WorldSimulator.invoke(actorNowPlaying, delta)
|
||||
}
|
||||
AppLoader.measureDebugTime("WeatherMixer.update") {
|
||||
measureDebugTime("WeatherMixer.update") {
|
||||
WeatherMixer.update(delta, actorNowPlaying, world)
|
||||
}
|
||||
AppLoader.measureDebugTime("BlockStats.update") {
|
||||
measureDebugTime("BlockStats.update") {
|
||||
BlockStats.update()
|
||||
}
|
||||
|
||||
// fill up visibleActorsRenderFront for wires, if:
|
||||
// 1. something is cued on the wire change queue
|
||||
// 2. wire renderclass changed
|
||||
if (wireChangeQueue.isNotEmpty() || selectedWireRenderClass != oldSelectedWireRenderClass) {
|
||||
measureDebugTime("Ingame.FillUpWiresBuffer") {
|
||||
fillUpWiresBuffer()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////
|
||||
@@ -620,6 +627,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
terrainChangeQueue.clear()
|
||||
wallChangeQueue.clear()
|
||||
wireChangeQueue.clear()
|
||||
|
||||
oldSelectedWireRenderClass = selectedWireRenderClass
|
||||
}
|
||||
|
||||
|
||||
@@ -659,11 +668,6 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
// deal with the uiFixture being closed
|
||||
if (uiFixture?.isClosed == true) { uiFixture = null }
|
||||
|
||||
// fill up visibleActorsRenderFront for wires
|
||||
measureDebugTime("Ingame.FillUpWiresBuffer") {
|
||||
fillUpWiresBuffer()
|
||||
}
|
||||
|
||||
IngameRenderer.invoke(
|
||||
paused,
|
||||
visibleActorsRenderBehind,
|
||||
|
||||
Reference in New Issue
Block a user