wire is back! but not the render

This commit is contained in:
minjaesong
2021-07-28 14:19:50 +09:00
parent 8cb3fc2d33
commit 5aacbe84b8
21 changed files with 228 additions and 107 deletions

View File

@@ -170,6 +170,11 @@ internal object BlocksDrawer {
// NO draw lightmap using colour filter, actors must also be hidden behind the darkness
///////////////////////////////////////////
/**
* Which wires should be drawn. Normally this value is set by the wiring item (e.g. wire pieces, wirecutters)
*/
var selectedWireRenderClass = ""
internal fun renderData() {
try {
@@ -200,10 +205,8 @@ internal object BlocksDrawer {
renderUsingBuffer(FLUID, projectionMatrix, drawGlow)
}
var drawWires = 0
private set
internal fun drawFront(projectionMatrix: Matrix4, drawWires: Int) {
internal fun drawFront(projectionMatrix: Matrix4) {
// blend mul
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D)
Gdx.gl.glEnable(GL20.GL_BLEND)
@@ -216,8 +219,7 @@ internal object BlocksDrawer {
gdxSetBlendNormal()
this.drawWires = drawWires
if (drawWires != 0) {
if (selectedWireRenderClass.isNotBlank()) {
//println("Wires! draw: $drawWires") // use F10 instead
renderUsingBuffer(WIRE, projectionMatrix, false)
}

View File

@@ -12,6 +12,7 @@ import net.torvald.terrarum.AppLoader.printdbg
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
import net.torvald.terrarum.blockproperties.Block
import net.torvald.terrarum.blockproperties.BlockCodex
import net.torvald.terrarum.blockproperties.BlockProp
import net.torvald.terrarum.blockproperties.Fluid
import net.torvald.terrarum.gameitem.ItemID
import net.torvald.terrarum.gameworld.GameWorld
@@ -102,13 +103,14 @@ class CreateTileAtlas {
throw Error("Path '${dir.path()}' is not a directory")
}
dir.list().filter { tgaFile -> !tgaFile.isDirectory && (tgaFile.name().matches(tileNameRegex)) }
// filter files that do not exist on the blockcodex
dir.list().filter { tgaFile -> !tgaFile.isDirectory && (BlockCodex.getOrNull("$modname:${tgaFile.nameWithoutExtension()}") != null) }
.sortedBy { it.nameWithoutExtension().toInt() }.forEach { tgaFile -> // toInt() to sort by the number, not lexicographically
tgaList.add(modname to tgaFile)
}
}
// Sift through the file list for blocks, but TGA format first
tgaList.forEach { (modname, filehandle) ->
printdbg(this, "processing $modname:${filehandle.name()}")