mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
lightmap edge-case fixed
when camera.x is in -15..-1, all thing shifts to left
This commit is contained in:
@@ -23,7 +23,6 @@ import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
* This will be rendered to a postprocessor FBO
|
||||
*/
|
||||
object IngameRenderer {
|
||||
|
||||
/** for non-private use, use with care! */
|
||||
lateinit var batch: SpriteBatch
|
||||
private lateinit var camera: OrthographicCamera
|
||||
@@ -274,8 +273,7 @@ object IngameRenderer {
|
||||
fboRGB_lightMixed.inAction(camera, batch) {
|
||||
|
||||
setCameraPosition(0f, 0f)
|
||||
val xrem = -(WorldCamera.x.toFloat() fmod TILE_SIZEF)
|
||||
val yrem = -(WorldCamera.y.toFloat() fmod TILE_SIZEF)
|
||||
val (xrem, yrem) = worldCamToRenderPos()
|
||||
|
||||
batch.inUse {
|
||||
// draw world
|
||||
@@ -357,8 +355,7 @@ object IngameRenderer {
|
||||
fboA_lightMixed.inAction(camera, batch) {
|
||||
|
||||
setCameraPosition(0f, 0f)
|
||||
val xrem = -(WorldCamera.x.toFloat() fmod TILE_SIZEF)
|
||||
val yrem = -(WorldCamera.y.toFloat() fmod TILE_SIZEF)
|
||||
val (xrem, yrem) = worldCamToRenderPos()
|
||||
|
||||
batch.inUse {
|
||||
// draw world
|
||||
@@ -557,4 +554,12 @@ object IngameRenderer {
|
||||
|
||||
LightmapRenderer.dispose()
|
||||
}
|
||||
|
||||
private fun worldCamToRenderPos(): Pair<Float, Float> {
|
||||
// for some reason it does not like integer. No, really; it breaks (jitter when you move) when you try to "fix" that.
|
||||
val xrem = -(WorldCamera.x.toFloat() fmod TILE_SIZEF)
|
||||
val yrem = -(WorldCamera.y.toFloat() fmod TILE_SIZEF)
|
||||
|
||||
return xrem to yrem
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ object PlayerBuilderSigrid {
|
||||
Block.ILLUMINATOR_WHITE, Block.ILLUMINATOR_BLACK, Block.ILLUMINATOR_ORANGE,
|
||||
Block.ILLUMINATOR_GREEN, Block.ILLUMINATOR_CYAN, Block.SUNSTONE,
|
||||
Block.ORE_COPPER,
|
||||
Block.PLATFORM_WOODEN
|
||||
Block.PLATFORM_STONE, Block.PLATFORM_WOODEN, Block.PLATFORM_BIRCH, Block.PLATFORM_BLOODROSE, Block.PLATFORM_EBONY
|
||||
)
|
||||
val walls = arrayOf(
|
||||
Block.AIR, Block.DIRT, Block.GLASS_CRUDE,
|
||||
|
||||
Reference in New Issue
Block a user