mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
fixed a bug with canvas texture blending
This commit is contained in:
@@ -350,8 +350,8 @@ inline fun FrameBuffer.inActionF(camera: OrthographicCamera?, batch: SpriteBatch
|
||||
|
||||
|
||||
private val rgbMultLUT = Array(256) { y -> IntArray(256) { x ->
|
||||
val i = (x % 256) / 255f
|
||||
val j = (y / 256) / 255f
|
||||
val i = x / 255f
|
||||
val j = y / 255f
|
||||
(i * j).times(255f).roundToInt()
|
||||
} }
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.IS_DEVELOPMENT_BUILD
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
@@ -66,7 +65,7 @@ class EntryPoint : ModuleEntryPoint() {
|
||||
}
|
||||
}
|
||||
|
||||
println("[Basegame.EntryPoint] Welcome back!")
|
||||
println("\n[Basegame.EntryPoint] Welcome back!")
|
||||
}
|
||||
|
||||
private fun makeNewItemObj(tile: BlockProp, isWall: Boolean) = object : GameItem(
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
@@ -68,12 +66,9 @@ internal class FixtureTapestry : FixtureBase {
|
||||
|
||||
// blend canvas texture
|
||||
for (y in 0 until pixmap.height) { for (x in 0 until pixmap.width) {
|
||||
val srcCol = canvas.getPixel(x % pixmap.width, y % pixmap.height)
|
||||
val srcCol = canvas.getPixel(x % canvas.width, y % canvas.height)
|
||||
val dstCol = pixmap.getPixel(x, y)
|
||||
// pixmap.drawPixel(x, y, dstCol rgbamul srcCol)
|
||||
val col = Color(dstCol) mul Color(srcCol)
|
||||
pixmap.setColor(col)
|
||||
pixmap.drawPixel(x, y)
|
||||
pixmap.drawPixel(x, y, dstCol rgbamul srcCol)
|
||||
} }
|
||||
|
||||
// draw frame
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.ItemCodex
|
||||
@@ -30,7 +29,7 @@ open class FixtureItemBase(originalID: ItemID, val fixtureClassName: String) : G
|
||||
protected var ghostItem: FixtureBase? = null
|
||||
get() {
|
||||
if (field == null)
|
||||
ghostItem = makeFixture()
|
||||
field = makeFixture()
|
||||
return field
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,11 @@ package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2019-05-16.
|
||||
@@ -20,7 +22,9 @@ class ItemTikiTorch(originalID: ItemID) : FixtureItemBase(originalID, "net.torva
|
||||
override val isDynamic = false
|
||||
override val material = Material()
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsTextureRegionPack("sprites-fixtures-tiki_torch.tga").get(0,0)
|
||||
get() = (CommonResourcePool.getOrPut("sprites-fixtures-tiki_torch.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/fixtures/tiki_torch.tga"), 16, 32, flipY = false)
|
||||
} as TextureRegionPack).get(0,0)
|
||||
override var baseToolSize: Double? = baseMass
|
||||
|
||||
init {
|
||||
|
||||
Reference in New Issue
Block a user