mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
more descriptive name for the blend-normal function because why there are two fucking standards for an alpha channel
This commit is contained in:
@@ -38,7 +38,7 @@ class ChunkLoadingLoadScreen(screenToBeLoaded: IngameInstance, private val world
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
||||
|
||||
val drawWidth = Toolkit.drawWidth
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ object IngameRenderer : Disposable {
|
||||
|
||||
// clear main or whatever super-FBO being used
|
||||
//clearBuffer()
|
||||
gdxClearAndSetBlend(.64f, .754f, .84f, 0f)
|
||||
gdxClearAndEnableBlend(.64f, .754f, .84f, 0f)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -252,7 +252,7 @@ object IngameRenderer : Disposable {
|
||||
aTex.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||
|
||||
fboMixedOut.inAction(camera, batch) {
|
||||
gdxClearAndSetBlend(0f, 0f, 0f, 0f)
|
||||
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
|
||||
|
||||
// draw sky
|
||||
WeatherMixer.render(camera, batch, world)
|
||||
@@ -269,7 +269,7 @@ object IngameRenderer : Disposable {
|
||||
|
||||
|
||||
batch.inUse {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.shader = shaderBlendGlow
|
||||
shaderBlendGlow.setUniformi("tex1", 1)
|
||||
batch.draw(rgbTex,
|
||||
@@ -287,7 +287,7 @@ object IngameRenderer : Disposable {
|
||||
) {
|
||||
debugMode = 1
|
||||
batch.inUse {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.shader = null
|
||||
batch.draw(rgbTex,
|
||||
-0.5f * rgbTex.regionWidth * zoom + 0.5f * rgbTex.regionWidth,
|
||||
@@ -314,7 +314,7 @@ object IngameRenderer : Disposable {
|
||||
) {
|
||||
debugMode = 2
|
||||
batch.inUse {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.shader = null
|
||||
batch.draw(aTex,
|
||||
-0.5f * aTex.regionWidth * zoom + 0.5f * aTex.regionWidth,
|
||||
@@ -348,7 +348,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
batch.inUse {
|
||||
// it's no use applying dithering here: colours are no longer "floats" once they're written to the FBO
|
||||
@@ -389,7 +389,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
// works but some UI elements have wrong transparency -> should be fixed with Terrarum.gdxCleanAndSetBlend -- Torvald 2019-01-12
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.color = Color.WHITE
|
||||
|
||||
|
||||
@@ -409,7 +409,7 @@ object IngameRenderer : Disposable {
|
||||
processKawaseBlur(lightmapFbo)
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -479,14 +479,14 @@ object IngameRenderer : Disposable {
|
||||
setCameraPosition(0f, 0f)
|
||||
val (xrem, yrem) = worldCamToRenderPos()
|
||||
|
||||
gdxSetBlend()
|
||||
gdxEnableBlend()
|
||||
|
||||
// App.getCurrentDitherTex().bind(1)
|
||||
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||
|
||||
batch.inUse {
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
// draw world
|
||||
batch.shader = shaderDemultiply
|
||||
@@ -497,7 +497,7 @@ object IngameRenderer : Disposable {
|
||||
lightTex.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||
|
||||
if (KeyToggler.isOn(Input.Keys.F8))
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
else
|
||||
blendMul(batch)
|
||||
|
||||
@@ -522,7 +522,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
}
|
||||
|
||||
private fun drawToA(
|
||||
@@ -536,7 +536,7 @@ object IngameRenderer : Disposable {
|
||||
fboA.inAction(null, null) {
|
||||
clearBuffer()
|
||||
// paint black
|
||||
gdxClearAndSetBlend(0f,0f,0f,1f) // solid black: so that unused area will be also black
|
||||
gdxClearAndEnableBlend(0f,0f,0f,1f) // solid black: so that unused area will be also black
|
||||
}
|
||||
fboA_lightMixed.inAction(null, null) { clearBuffer() }
|
||||
|
||||
@@ -591,7 +591,7 @@ object IngameRenderer : Disposable {
|
||||
lightTex.texture.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
|
||||
|
||||
if (KeyToggler.isOn(Input.Keys.F8))
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
else
|
||||
blendMul(batch)
|
||||
|
||||
@@ -612,7 +612,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
}
|
||||
|
||||
private fun drawOverlayActors(actors: List<ActorWithBody>?) {
|
||||
@@ -652,7 +652,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
private fun clearBuffer() {
|
||||
gdxClearAndSetBlend(0f,0f,0f,0f)
|
||||
gdxClearAndEnableBlend(0f,0f,0f,0f)
|
||||
}
|
||||
|
||||
private fun moveCameraToWorldCoord() {
|
||||
|
||||
@@ -297,7 +297,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
//camera.setToOrtho(true, AppLoader.terrarumAppConfig.screenWf, AppLoader.terrarumAppConfig.screenHf)
|
||||
|
||||
// render world
|
||||
gdxClearAndSetBlend(.64f, .754f, .84f, 1f)
|
||||
gdxClearAndEnableBlend(.64f, .754f, .84f, 1f)
|
||||
|
||||
|
||||
if (!demoWorld.layerTerrain.ptr.destroyed) { // FIXME q&d hack to circumvent the dangling pointer issue #26
|
||||
@@ -328,7 +328,7 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
private fun renderOverlayTexts() {
|
||||
setCameraPosition(0f, 0f)
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.shader = null
|
||||
|
||||
batch.color = Color.LIGHT_GRAY
|
||||
|
||||
@@ -55,7 +55,7 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
||||
|
||||
val drawWidth = Toolkit.drawWidth
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ internal class UIStorageChest : UICanvas(
|
||||
itemListPlayer.render(batch, camera)
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
// encumbrance meter
|
||||
val encumbranceText = Lang["GAME_INVENTORY_ENCUMBRANCE"]
|
||||
|
||||
@@ -465,7 +465,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
||||
|
||||
// control hints
|
||||
val controlHintXPos = thisOffsetX.toFloat()
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
App.fontGame.draw(batch, controlHelp, controlHintXPos, full.yEnd - 20)
|
||||
|
||||
|
||||
@@ -482,7 +482,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
||||
else 0f
|
||||
App.fontGame.draw(batch, encumbranceText, encumbBarTextXPos, encumbBarYPos - 3f)
|
||||
// encumbrance bar background
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
val encumbCol = UIItemInventoryCellCommonRes.getHealthMeterColour(1f - encumbrancePerc, 0f, 1f)
|
||||
val encumbBack = encumbCol mul UIItemInventoryCellCommonRes.meterBackDarkening
|
||||
batch.color = encumbBack
|
||||
@@ -511,7 +511,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
||||
}
|
||||
|
||||
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
}
|
||||
|
||||
override fun doOpening(delta: Float) {
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Second
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blendNormalStraightAlpha
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
|
||||
@@ -51,7 +51,7 @@ class Notification : UICanvas() {
|
||||
private val drawColor = Color(1f, 1f, 1f, 1f)
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
drawColor.a = handler.opacity
|
||||
fontCol.a = handler.opacity
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.BlockCodex
|
||||
import net.torvald.terrarum.ItemCodex
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blendNormalStraightAlpha
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory.CELLCOLOUR_WHITE
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
@@ -128,7 +128,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
palette.forEach { it.render(batch, camera) }
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
// gaps between tabs and close button
|
||||
batch.color = DEFAULT_BACKGROUNDCOL
|
||||
|
||||
@@ -91,7 +91,7 @@ internal class UIInventoryCells(
|
||||
|
||||
// control hints
|
||||
val controlHintXPos = full.offsetX
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.color = Color.WHITE
|
||||
App.fontGame.draw(batch, full.listControlHelp, controlHintXPos, full.yEnd - 20)
|
||||
|
||||
@@ -110,7 +110,7 @@ internal class UIInventoryCells(
|
||||
App.fontGame.draw(batch, encumbranceText, encumbBarTextXPos, encumbBarYPos - 3f)
|
||||
|
||||
// encumbrance bar background
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
val encumbCol = UIItemInventoryCellCommonRes.getHealthMeterColour(1f - encumbrancePerc, 0f, 1f)
|
||||
val encumbBack = encumbCol mul UIItemInventoryCellCommonRes.meterBackDarkening
|
||||
batch.color = encumbBack
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.INGAME
|
||||
import net.torvald.terrarum.Terrarum.getPlayerSaveFiledesc
|
||||
import net.torvald.terrarum.Terrarum.getWorldSaveFiledesc
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blendNormalStraightAlpha
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gamecontroller.TerrarumKeyboardEvent
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
@@ -271,7 +271,7 @@ class UIInventoryEscMenu(val full: UIInventoryFull) : UICanvas() {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.color = Color.WHITE
|
||||
screenRenders[screen](batch, camera)
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ class UIInventoryFull(
|
||||
|
||||
fun drawBackground(batch: SpriteBatch) {
|
||||
batch.end()
|
||||
gdxSetBlendNormal()
|
||||
gdxBlendNormalStraightAlpha()
|
||||
|
||||
if (shapeRenderer == null) {
|
||||
shapeRenderer = ShapeRenderer()
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||
import net.torvald.terrarum.blockstats.MinimapComposer
|
||||
import net.torvald.terrarum.blockstats.MinimapComposer.MINIMAP_TILE_HEIGHT
|
||||
@@ -67,7 +66,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
val cellOffY = INVENTORY_CELLS_OFFSET_Y()
|
||||
val worldWidth = INGAME.world.width
|
||||
|
||||
@@ -145,7 +144,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
|
||||
minimapFBO.inActionF(minimapCamera, batch) {
|
||||
gdxClearAndSetBlend(MINIMAP_SKYCOL)
|
||||
gdxClearAndEnableBlend(MINIMAP_SKYCOL)
|
||||
|
||||
batch.inUse {
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class UIItemInventoryEquippedView(
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
val posXDelta = posX - oldPosX
|
||||
itemGrid.forEach { it.posX += posXDelta }
|
||||
@@ -84,7 +84,7 @@ class UIItemInventoryEquippedView(
|
||||
// sprite
|
||||
INGAME.actorNowPlaying?.let { actor ->
|
||||
actor.sprite?.let {
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
batch.color = SPRITE_DRAW_COL
|
||||
|
||||
|
||||
@@ -295,7 +295,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
||||
// to hide the "flipped skybox" artefact
|
||||
batch.end()
|
||||
|
||||
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||
gdxClearAndEnableBlend(.094f, .094f, .094f, 0f)
|
||||
|
||||
batch.begin()
|
||||
|
||||
@@ -314,7 +314,7 @@ class UILoadDemoSavefiles(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
lateinit var savePixmap: Pixmap
|
||||
sliderFBO.inAction(camera as OrthographicCamera, batch) {
|
||||
gdxClearAndSetBlend(0f, 0f, 0f, 0f)
|
||||
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
|
||||
|
||||
setCameraPosition(batch, camera, 0f, 0f)
|
||||
batch.color = Color.WHITE
|
||||
@@ -787,7 +787,7 @@ class UIItemWorldCells(
|
||||
|
||||
// draw thumbnail
|
||||
batch.color = Color.WHITE
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
batch.draw(thumb ?: CommonResourcePool.getAsTextureRegion("terrarum-defaultsavegamethumb"), x, y, width.toFloat(), height.toFloat())
|
||||
// draw gradient
|
||||
blendMul(batch)
|
||||
@@ -795,7 +795,7 @@ class UIItemWorldCells(
|
||||
|
||||
// draw texts
|
||||
batch.color = highlightCol
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
|
||||
// save status icon
|
||||
(if (saveDamaged) icons.get(1,0)
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ItemCodex
|
||||
import net.torvald.terrarum.blendNormal
|
||||
import net.torvald.terrarum.blendNormalStraightAlpha
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.BuildingMaker
|
||||
@@ -74,7 +74,7 @@ class UIPaletteSelector(val parent: BuildingMaker) : UICanvas() {
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
// draw title bar
|
||||
batch.color = UINSMenu.DEFAULT_TITLEBACKCOL
|
||||
blendNormal(batch)
|
||||
blendNormalStraightAlpha(batch)
|
||||
Toolkit.fillArea(batch, 0, 0, width, LINE_HEIGHT)
|
||||
|
||||
// draw "Pal."
|
||||
|
||||
@@ -141,7 +141,7 @@ class UITitleModules(val remoCon: UIRemoCon) : UICanvas() {
|
||||
|
||||
lateinit var savePixmap: Pixmap
|
||||
sliderFBO.inAction(camera as OrthographicCamera, batch) {
|
||||
gdxClearAndSetBlend(0f, 0f, 0f, 0f)
|
||||
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
|
||||
|
||||
setCameraPosition(batch, camera, 0f, 0f)
|
||||
batch.color = Color.WHITE
|
||||
|
||||
Reference in New Issue
Block a user