Houston, we have a render (again)

This commit is contained in:
minjaesong
2017-10-07 22:21:37 +09:00
parent f1b4252731
commit 681dd84cb3
7 changed files with 35 additions and 28 deletions

Binary file not shown.

View File

@@ -590,26 +590,38 @@ class Ingame(val batch: SpriteBatch) : Screen {
processBlur(lightmapFboA, lightmapFboB, LightmapRenderer.DRAW_FOR_RGB) processBlur(lightmapFboA, lightmapFboB, LightmapRenderer.DRAW_FOR_RGB)
worldDrawFrameBuffer.inAction(camera, batch) { worldDrawFrameBuffer.inAction(camera, batch) {
// draw-with-poly doesn't want to co-op with peasant spriteBatch...
batch.inUse { batch.inUse {
batch.shader = null batch.shader = null
batch.color = Color.WHITE batch.color = Color.WHITE
blendNormal() blendNormal()
}
setCameraPosition(0f, 0f)
BlocksDrawer.renderWall(batch)
setCameraPosition(0f, 0f)
BlocksDrawer.renderWall(batch)
batch.inUse {
moveCameraToWorldCoord() moveCameraToWorldCoord()
actorsRenderBehind.forEach { it.drawBody(batch) } actorsRenderBehind.forEach { it.drawBody(batch) }
particlesContainer.forEach { it.drawBody(batch) } particlesContainer.forEach { it.drawBody(batch) }
setCameraPosition(0f, 0f) }
BlocksDrawer.renderTerrain(batch)
setCameraPosition(0f, 0f)
BlocksDrawer.renderTerrain(batch)
batch.inUse {
///////////////// /////////////////
// draw actors // // draw actors //
///////////////// /////////////////
@@ -626,7 +638,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
///////////////////////////// /////////////////////////////
setCameraPosition(0f, 0f) setCameraPosition(0f, 0f)
BlocksDrawer.renderFront(batch, false) //BlocksDrawer.renderFront(batch, false)
// --> blendNormal() <-- by BlocksDrawer.renderFront // --> blendNormal() <-- by BlocksDrawer.renderFront
FeaturesDrawer.drawEnvOverlay(batch) FeaturesDrawer.drawEnvOverlay(batch)

View File

@@ -1,12 +1,8 @@
package net.torvald.terrarum package net.torvald.terrarum
import com.badlogic.gdx.Game
import com.badlogic.gdx.Gdx import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Screen import com.badlogic.gdx.Screen
import com.badlogic.gdx.backends.lwjgl.LwjglApplication
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration
import com.badlogic.gdx.graphics.* import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.BitmapFont
import com.badlogic.gdx.graphics.g2d.SpriteBatch import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.badlogic.gdx.graphics.glutils.ShaderProgram import com.badlogic.gdx.graphics.glutils.ShaderProgram
@@ -14,11 +10,7 @@ import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.utils.GdxRuntimeException import com.badlogic.gdx.utils.GdxRuntimeException
import com.google.gson.JsonArray import com.google.gson.JsonArray
import com.google.gson.JsonPrimitive import com.google.gson.JsonPrimitive
import net.torvald.random.HQRNG
import net.torvald.terrarum.Terrarum.RENDER_FPS
import net.torvald.terrarum.TerrarumAppLoader
import net.torvald.terrarum.gameactors.floorInt import net.torvald.terrarum.gameactors.floorInt
import net.torvald.terrarum.gamecontroller.IngameController
import net.torvald.terrarum.imagefont.TinyAlphNum import net.torvald.terrarum.imagefont.TinyAlphNum
import net.torvald.terrarum.imagefont.Watch7SegMain import net.torvald.terrarum.imagefont.Watch7SegMain
import net.torvald.terrarum.imagefont.WatchDotAlph import net.torvald.terrarum.imagefont.WatchDotAlph
@@ -35,9 +27,7 @@ import org.lwjgl.BufferUtils
import org.lwjgl.input.Controllers import org.lwjgl.input.Controllers
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.lang.management.ManagementFactory
import java.nio.IntBuffer
import java.util.*
/** /**
* Slick2d Version Created by minjaesong on 2015-12-30. * Slick2d Version Created by minjaesong on 2015-12-30.

View File

@@ -272,8 +272,6 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
BlocksDrawer.renderWall(batch) BlocksDrawer.renderWall(batch)
BlocksDrawer.renderTerrain(batch) BlocksDrawer.renderTerrain(batch)
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // don't know why it is needed; it really depresses me
FeaturesDrawer.drawEnvOverlay(batch) FeaturesDrawer.drawEnvOverlay(batch)

View File

@@ -398,6 +398,7 @@ object BlocksDrawer {
} }
@Deprecated("It's broken right now; don't use it") @Deprecated("It's broken right now; don't use it")
// FIXME biatch
fun renderFront(batch: SpriteBatch, drawWires: Boolean) { fun renderFront(batch: SpriteBatch, drawWires: Boolean) {
// blend mul // blend mul
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D) Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
@@ -734,15 +735,15 @@ object BlocksDrawer {
val tilesBufferAsTex = Texture(tilesBuffer) val tilesBufferAsTex = Texture(tilesBuffer)
tilesBufferAsTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest) tilesBufferAsTex.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest)
tilesBufferAsTex.bind(2) tilesBufferAsTex.bind(1) // trying 1 and 0...
tileAtlas.texture.bind(1) // for some fuck reason, it must be bound as last tileAtlas.texture.bind(0) // for some fuck reason, it must be bound as last
shader.begin() shader.begin()
shader.setUniformMatrix("u_projTrans", projectionMatrix)//camera.combined) shader.setUniformMatrix("u_projTrans", projectionMatrix)//camera.combined)
shader.setUniformf("colourFilter", vertexColour) shader.setUniformf("colourFilter", vertexColour)
shader.setUniformf("screenDimension", Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat()) shader.setUniformf("screenDimension", Gdx.graphics.width.toFloat(), Gdx.graphics.height.toFloat())
shader.setUniformi("tilesAtlas", 1) shader.setUniformi("tilesAtlas", 0)
shader.setUniformi("tilemap", 2) shader.setUniformi("tilemap", 1)
shader.setUniformi("tilemapDimension", tilesBuffer.width, tilesBuffer.height) shader.setUniformi("tilemapDimension", tilesBuffer.width, tilesBuffer.height)
shader.setUniformf("tilesInAxes", tilesInHorizontal.toFloat(), tilesInVertical.toFloat()) shader.setUniformf("tilesInAxes", tilesInHorizontal.toFloat(), tilesInVertical.toFloat())
shader.setUniformi("cameraTranslation", WorldCamera.x fmod TILE_SIZE, WorldCamera.y fmod TILE_SIZE) shader.setUniformi("cameraTranslation", WorldCamera.x fmod TILE_SIZE, WorldCamera.y fmod TILE_SIZE)

Binary file not shown.

Binary file not shown.