Files
Terrarum/src/net/torvald/terrarum/PostProcessor.kt
minjaesong 9aa4919bab 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)
2017-11-02 17:47:52 +09:00

29 lines
823 B
Kotlin

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
}
}