mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
ingame will only render visible actor
This commit is contained in:
@@ -66,6 +66,11 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
private val actorsRenderFront = ArrayList<ActorWithBody>(ACTORCONTAINER_INITIAL_SIZE)
|
private val actorsRenderFront = ArrayList<ActorWithBody>(ACTORCONTAINER_INITIAL_SIZE)
|
||||||
private val actorsRenderOverlay= ArrayList<ActorWithBody>(ACTORCONTAINER_INITIAL_SIZE)
|
private val actorsRenderOverlay= ArrayList<ActorWithBody>(ACTORCONTAINER_INITIAL_SIZE)
|
||||||
|
|
||||||
|
private var visibleActorsRenderBehind: List<ActorWithBody> = ArrayList(1)
|
||||||
|
private var visibleActorsRenderMiddle: List<ActorWithBody> = ArrayList(1)
|
||||||
|
private var visibleActorsRenderMidTop: List<ActorWithBody> = ArrayList(1)
|
||||||
|
private var visibleActorsRenderFront: List<ActorWithBody> = ArrayList(1)
|
||||||
|
private var visibleActorsRenderOverlay: List<ActorWithBody> = ArrayList(1)
|
||||||
|
|
||||||
//var screenZoom = 1.0f // definition moved to IngameInstance
|
//var screenZoom = 1.0f // definition moved to IngameInstance
|
||||||
//val ZOOM_MAXIMUM = 4.0f // definition moved to IngameInstance
|
//val ZOOM_MAXIMUM = 4.0f // definition moved to IngameInstance
|
||||||
@@ -453,10 +458,9 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
|
|
||||||
// ASYNCHRONOUS UPDATE AND RENDER //
|
// ASYNCHRONOUS UPDATE AND RENDER //
|
||||||
|
|
||||||
|
|
||||||
/** UPDATE CODE GOES HERE */
|
/** UPDATE CODE GOES HERE */
|
||||||
|
val dt = AppLoader.getSmoothDelta()
|
||||||
updateAkku += AppLoader.getSmoothDelta()
|
updateAkku += dt
|
||||||
|
|
||||||
var i = 0L
|
var i = 0L
|
||||||
while (updateAkku >= delta) {
|
while (updateAkku >= delta) {
|
||||||
@@ -467,6 +471,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
AppLoader.debugTimers["Ingame.updateCounter"] = i
|
AppLoader.debugTimers["Ingame.updateCounter"] = i
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** RENDER CODE GOES HERE */
|
/** RENDER CODE GOES HERE */
|
||||||
AppLoader.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
AppLoader.debugTimers["Ingame.render"] = measureNanoTime { renderGame() }
|
||||||
AppLoader.debugTimers["Ingame.render-Light"] =
|
AppLoader.debugTimers["Ingame.render-Light"] =
|
||||||
@@ -517,6 +522,13 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
particlesContainer.forEach { if (!it.flagDespawn) particlesActive++; it.update(delta) }
|
particlesContainer.forEach { if (!it.flagDespawn) particlesActive++; it.update(delta) }
|
||||||
// TODO thread pool(?)
|
// TODO thread pool(?)
|
||||||
CollisionSolver.process()
|
CollisionSolver.process()
|
||||||
|
|
||||||
|
|
||||||
|
visibleActorsRenderBehind = actorsRenderBehind.filter { it.inScreen() }
|
||||||
|
visibleActorsRenderMiddle = actorsRenderMiddle.filter { it.inScreen() }
|
||||||
|
visibleActorsRenderMidTop = actorsRenderMidTop.filter { it.inScreen() }
|
||||||
|
visibleActorsRenderFront = actorsRenderFront.filter { it.inScreen() }
|
||||||
|
visibleActorsRenderOverlay=actorsRenderOverlay.filter { it.inScreen() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -538,15 +550,13 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
private fun renderGame() {
|
private fun renderGame() {
|
||||||
Gdx.graphics.setTitle(getCanonicalTitle())
|
Gdx.graphics.setTitle(getCanonicalTitle())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IngameRenderer.invoke(
|
IngameRenderer.invoke(
|
||||||
world as GameWorldExtension,
|
world as GameWorldExtension,
|
||||||
actorsRenderBehind,
|
visibleActorsRenderBehind,
|
||||||
actorsRenderMiddle,
|
visibleActorsRenderMiddle,
|
||||||
actorsRenderMidTop,
|
visibleActorsRenderMidTop,
|
||||||
actorsRenderFront,
|
visibleActorsRenderFront,
|
||||||
actorsRenderOverlay,
|
visibleActorsRenderOverlay,
|
||||||
particlesContainer,
|
particlesContainer,
|
||||||
actorNowPlaying,
|
actorNowPlaying,
|
||||||
uiContainer
|
uiContainer
|
||||||
@@ -959,4 +969,5 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
|
|||||||
printdbg(this, "-> $it")
|
printdbg(this, "-> $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user