mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-06 08:38:30 +09:00
fix: new world from world portal not updating world ref of IngameRenderer
This commit is contained in:
@@ -175,6 +175,9 @@ object IngameRenderer : Disposable {
|
||||
* - When the game make transition to the new world (advancing to the next level/entering or exiting the room)
|
||||
*/
|
||||
fun setRenderedWorld(world: GameWorld) {
|
||||
printdbg(this, "Set new RenderedWorld (UUID=${world.worldIndex}) at time ${System.currentTimeMillis()}, called by:")
|
||||
printStackTrace(this)
|
||||
|
||||
try {
|
||||
if (this.world != world) {
|
||||
// printdbg(this, "World change detected -- " +
|
||||
|
||||
@@ -52,6 +52,8 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
|
||||
previewPixmap.setColor(Color.BLACK)
|
||||
previewPixmap.fill()
|
||||
|
||||
IngameRenderer.setRenderedWorld(world)
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
|
||||
@@ -201,6 +201,7 @@ internal object BlocksDrawer {
|
||||
}
|
||||
catch (e: ClassCastException) { }
|
||||
|
||||
if (!world.layerTerrain.ptrDestroyed) {
|
||||
measureDebugTime("Renderer.Tiling") {
|
||||
drawTiles(WALL)
|
||||
drawTiles(TERRAIN) // regular tiles
|
||||
@@ -209,6 +210,7 @@ internal object BlocksDrawer {
|
||||
//drawTiles(WIRE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal fun drawWall(projectionMatrix: Matrix4, drawGlow: Boolean) {
|
||||
gdxBlendNormalStraightAlpha()
|
||||
|
||||
@@ -139,7 +139,9 @@ object LightmapRenderer {
|
||||
printdbg(this, "Overscan open: $overscan_open; opaque: $overscan_opaque")
|
||||
}
|
||||
|
||||
fun recalculate(actorContainer: List<ActorWithBody>) = _recalculate(actorContainer, lightmap)
|
||||
fun recalculate(actorContainer: List<ActorWithBody>) {
|
||||
if (!world.layerTerrain.ptrDestroyed) _recalculate(actorContainer, lightmap)
|
||||
}
|
||||
|
||||
private fun _recalculate(actorContainer: List<ActorWithBody>, lightmap: UnsafeCvecArray) {
|
||||
try {
|
||||
@@ -661,6 +663,7 @@ object LightmapRenderer {
|
||||
|
||||
internal fun draw(): Texture {
|
||||
|
||||
if (!world.layerTerrain.ptrDestroyed) {
|
||||
// when shader is not used: 0.5 ms on 6700K
|
||||
App.measureDebugTime("Renderer.LightToScreen") {
|
||||
|
||||
@@ -670,7 +673,8 @@ object LightmapRenderer {
|
||||
val this_y_end = for_draw_y_end
|
||||
|
||||
// wipe out beforehand. You DO need this
|
||||
lightBuffer.blending = Pixmap.Blending.None // gonna overwrite (remove this line causes the world to go bit darker)
|
||||
lightBuffer.blending =
|
||||
Pixmap.Blending.None // gonna overwrite (remove this line causes the world to go bit darker)
|
||||
lightBuffer.setColor(0)
|
||||
lightBuffer.fill()
|
||||
|
||||
@@ -736,6 +740,7 @@ object LightmapRenderer {
|
||||
batch.draw(_lightBufferAsTex, 0f, 0f, _lightBufferAsTex.width * DRAW_TILE_SIZE, _lightBufferAsTex.height * DRAW_TILE_SIZE)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
return _lightBufferAsTex
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user