renderFront is fixed

This commit is contained in:
minjaesong
2017-10-14 02:48:52 +09:00
parent d9a01a70c3
commit 83b9f74100
3 changed files with 21 additions and 9 deletions

View File

@@ -592,7 +592,7 @@ class Ingame(val batch: SpriteBatch) : Screen {
worldDrawFrameBuffer.inAction(camera, batch) {
// draw-with-poly doesn't want to co-op with peasant spriteBatch...
// draw-with-poly doesn't want to co-op with peasant spriteBatch... (it hides sprites)
batch.inUse {
batch.shader = null
@@ -636,10 +636,16 @@ class Ingame(val batch: SpriteBatch) : Screen {
/////////////////////////////
// draw map related stuffs //
/////////////////////////////
}
setCameraPosition(0f, 0f)
//BlocksDrawer.renderFront(batch, false)
setCameraPosition(0f, 0f)
BlocksDrawer.renderFront(batch, false)
batch.inUse {
// --> blendNormal() <-- by BlocksDrawer.renderFront
FeaturesDrawer.drawEnvOverlay(batch)

View File

@@ -271,6 +271,7 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
// draw tiles //
BlocksDrawer.renderWall(batch)
BlocksDrawer.renderTerrain(batch)
BlocksDrawer.renderFront(batch, false)
FeaturesDrawer.drawEnvOverlay(batch)

View File

@@ -397,26 +397,28 @@ object BlocksDrawer {
renderUsingBuffer(TERRAIN, batch.projectionMatrix)
}
@Deprecated("It's broken right now; don't use it")
// FIXME biatch
fun renderFront(batch: SpriteBatch, drawWires: Boolean) {
// blend mul
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
Gdx.gl.glEnable(GL20.GL_BLEND)
Gdx.gl.glBlendFunc(GL20.GL_DST_COLOR, GL20.GL_ONE_MINUS_SRC_ALPHA)
drawTiles(TERRAIN, true) // blendmul tiles
renderUsingBuffer(TERRAIN, batch.projectionMatrix)
if (drawWires) {
drawTiles(WIRE, false)
renderUsingBuffer(WIRE, batch.projectionMatrix)
}
// blend normal
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
Gdx.gl.glEnable(GL20.GL_BLEND)
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
if (drawWires) {
drawTiles(WIRE, false)
renderUsingBuffer(WIRE, batch.projectionMatrix)
}
}
private val tileDrawLightThreshold = 2f / LightmapRenderer.MUL
@@ -522,6 +524,9 @@ object BlocksDrawer {
if (isBlendMul(thisTile)) {
writeToBuffer(mode, x - for_x_start, y - for_y_start, thisTileX, thisTileY)
}
else {
writeToBuffer(mode, x - for_x_start, y - for_y_start, 0, 0)
}
}
else {
// do NOT add "if (!isBlendMul(thisTile))"!