mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
dirty way: loads dithered/passthru shader according to the game's config (boolean fxdither)
29 lines
823 B
Kotlin
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
|
|
|
|
}
|
|
|
|
} |