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