fluidmap won't have errenous behaviour at the world edge; tga alpha fix

This commit is contained in:
Minjae Song
2018-12-19 01:53:09 +09:00
parent 23d557b6b2
commit 597e1acee4
6 changed files with 18 additions and 7 deletions

Binary file not shown.

View File

@@ -25,6 +25,7 @@ object WorldSimulator {
* In tiles;
* square width/height = field * 2
*/
// TODO: increase the radius and then MULTITHREAD
const val FLUID_UPDATING_SQUARE_RADIUS = 80 // larger value will have dramatic impact on performance
const private val DOUBLE_RADIUS = FLUID_UPDATING_SQUARE_RADIUS * 2

View File

@@ -4,13 +4,15 @@ import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.gameactors.faction.FactionCodex
import net.torvald.terrarum.gameworld.BlockAddress
import net.torvald.terrarum.gameworld.GameWorld
import net.torvald.terrarum.gameworld.fmod
/**
* Created by minjaesong on 2016-03-27.
*/
object LandUtil {
fun getBlockAddr(world: GameWorld, x: Int, y: Int): BlockAddress =
(world.width * y).toLong() + x
// coercing and fmod-ing follows ROUNDWORLD rule
(world.width * y.coerceIn(0, world.height - 1)).toLong() + x.fmod(world.width)
fun resolveBlockAddr(world: GameWorld, t: BlockAddress): Pair<Int, Int> =
Pair((t % world.width).toInt(), (t / world.width).toInt())
@@ -26,4 +28,6 @@ object LandUtil {
Terrarum.ingame!!.getActorByID(id)
else
FactionCodex.getFactionByID(id)
}

View File

@@ -82,6 +82,12 @@ internal object BlocksDrawer {
private val shader = ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/tiling.frag"))
init {
// PNG still doesn't work right.
// The thing is, pixel with alpha 0 must have RGB of also 0, which PNG does not guarantee it.
// (pixels of RGB = 255, A = 0 -- white transparent -- causes 'glow')
// with TGA, you have a complete control over this, with the expense of added hassle on your side.
// -- Torvald, 2018-12-19
// hard-coded as tga.gz
val gzFileList = listOf("blocks/terrain.tga.gz", "blocks/wire.tga.gz", "blocks/terrain_autumn.tga.gz")
val gzTmpFName = listOf("tmp_terrain.tga", "tmp_wire.tga", "tmp_terrain_autumn.tga")

Binary file not shown.