postprocessor for 3dlut colcorr; dithering should be managed in "dirty" way

dirty way: loads dithered/passthru shader according to the game's config (boolean fxdither)
This commit is contained in:
minjaesong
2017-11-02 17:47:52 +09:00
parent f5636fe0d3
commit 7cd7b4047f
9 changed files with 158 additions and 35 deletions

View File

@@ -0,0 +1,29 @@
package net.torvald.terrarum
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.GL20
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
object PostProcessor {
private val batch = SpriteBatch()
fun draw(screenTexHolder: FrameBuffer) {
//Gdx.gl.glClearColor(.094f, .094f, .094f, 1f)
//Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
batch.shader = null
batch.inUse {
val texture = screenTexHolder.colorBufferTexture
batch.shader.setUniformMatrix("u_projTrans", batch.projectionMatrix)
batch.draw(texture, 0f, 0f, texture.width.toFloat(), texture.height.toFloat())
}
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // don't know why it is needed; it really depresses me
}
}