mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-07 00:54:05 +09:00
Compare commits
12 Commits
world-chun
...
v0.5.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a24eab209b | ||
|
|
6ec5ba5603 | ||
|
|
8cf4b5d9a9 | ||
|
|
5bf60cfa82 | ||
|
|
5cc7db8ecc | ||
|
|
89b12aabb4 | ||
|
|
f5846d9bae | ||
|
|
d460447331 | ||
|
|
63fe28eee2 | ||
|
|
2d7ef6e9ff | ||
|
|
fa3a129991 | ||
|
|
4cc74a85d1 |
@@ -3,6 +3,7 @@ CheatWarnTest
|
|||||||
CodexEdictis
|
CodexEdictis
|
||||||
ExportAtlas
|
ExportAtlas
|
||||||
ExportCodices
|
ExportCodices
|
||||||
|
ExportFBO
|
||||||
ExportMap
|
ExportMap
|
||||||
ExportMap2
|
ExportMap2
|
||||||
ExportWorld
|
ExportWorld
|
||||||
|
|||||||
|
@@ -132,8 +132,8 @@ id;classname;tags
|
|||||||
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal;FIXTURE,STATION
|
320;net.torvald.terrarum.modulebasegame.gameitems.ItemWorldPortal;FIXTURE,STATION
|
||||||
|
|
||||||
# industrial
|
# industrial
|
||||||
2048;net.torvald.terrarum.modulebasegame.gameitems.ItemInductionMotor;FIXTURE,POWER,KINETIC
|
#2048;net.torvald.terrarum.modulebasegame.gameitems.ItemInductionMotor;FIXTURE,POWER,KINETIC
|
||||||
2049;net.torvald.terrarum.modulebasegame.gameitems.ItemGearbox;FIXTURE,POWER,KINETIC
|
#2049;net.torvald.terrarum.modulebasegame.gameitems.ItemGearbox;FIXTURE,POWER,KINETIC
|
||||||
|
|
||||||
# data storage (discs; 256)
|
# data storage (discs; 256)
|
||||||
# 32768 is a reserved number for a blank disc
|
# 32768 is a reserved number for a blank disc
|
||||||
@@ -179,5 +179,5 @@ id;classname;tags
|
|||||||
1048835;net.torvald.terrarum.modulebasegame.gameitems.ItemBucketIron03;FLUIDSTORAGE,OPENSTORAGE
|
1048835;net.torvald.terrarum.modulebasegame.gameitems.ItemBucketIron03;FLUIDSTORAGE,OPENSTORAGE
|
||||||
|
|
||||||
# reserved for debug items
|
# reserved for debug items
|
||||||
16777216;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessWaterBucket;DEBUG,TOOL
|
#16777216;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessWaterBucket;DEBUG,TOOL
|
||||||
16777217;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessLavaBucket;DEBUG,TOOL
|
#16777217;net.torvald.terrarum.modulebasegame.gameitems.ItemBottomlessLavaBucket;DEBUG,TOOL
|
||||||
|
|||||||
|
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ITEM_ALLOYING_FURNACE": "Alloying Furnace",
|
"ITEM_ALLOYING_FURNACE": "Alloying Furnace",
|
||||||
|
"ITEM_AXLE": "Axle",
|
||||||
"ITEM_BRICK_SINGULAR": "Brick", /* always singular */
|
"ITEM_BRICK_SINGULAR": "Brick", /* always singular */
|
||||||
"ITEM_BUCKET_IRON": "Iron Bucket %1$s",
|
"ITEM_BUCKET_IRON": "Iron Bucket %1$s",
|
||||||
"ITEM_BUCKET_WOODEN": "Wooden Bucket %1$s",
|
"ITEM_BUCKET_WOODEN": "Wooden Bucket %1$s",
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
"ITEM_ELECTRIC_WORKBENCH": "Electric Workbench",
|
"ITEM_ELECTRIC_WORKBENCH": "Electric Workbench",
|
||||||
"ITEM_ENGRAVING_WORKBENCH": "Engraving Workbench",
|
"ITEM_ENGRAVING_WORKBENCH": "Engraving Workbench",
|
||||||
"ITEM_FURNACE_AND_ANVIL": "Furnace and Anvil",
|
"ITEM_FURNACE_AND_ANVIL": "Furnace and Anvil",
|
||||||
|
"ITEM_GEARBOX": "Gearbox",
|
||||||
"ITEM_GEM_RUBY": "Raw Ruby",
|
"ITEM_GEM_RUBY": "Raw Ruby",
|
||||||
"ITEM_GEM_EMERALD": "Raw Emerald",
|
"ITEM_GEM_EMERALD": "Raw Emerald",
|
||||||
"ITEM_GEM_SAPPHIRE": "Raw Sapphire",
|
"ITEM_GEM_SAPPHIRE": "Raw Sapphire",
|
||||||
@@ -30,6 +32,7 @@
|
|||||||
"ITEM_HATCHET_STEEL": "Steel Axe",
|
"ITEM_HATCHET_STEEL": "Steel Axe",
|
||||||
"ITEM_HATCHET_STONE": "Stone Axe",
|
"ITEM_HATCHET_STONE": "Stone Axe",
|
||||||
"ITEM_HATCHET_WOODEN": "Wooden Axe",
|
"ITEM_HATCHET_WOODEN": "Wooden Axe",
|
||||||
|
"ITEM_INDUCTION_MOTOR": "Induction Motor",
|
||||||
"ITEM_INGOT_BRASS": "Brass Ingot",
|
"ITEM_INGOT_BRASS": "Brass Ingot",
|
||||||
"ITEM_INGOT_BRONZE": "Bronze Ingot",
|
"ITEM_INGOT_BRONZE": "Bronze Ingot",
|
||||||
"ITEM_INGOT_COPPER": "Copper Ingot",
|
"ITEM_INGOT_COPPER": "Copper Ingot",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ id;drop;name;renderclass;accept;inputcount;inputtype;outputtype;javaclass;invent
|
|||||||
2;2;WIRE_POWER_HIGH;power;power_high;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,6,4;1;"POWERWIRE_HIGH"
|
2;2;WIRE_POWER_HIGH;power;power_high;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,6,4;1;"POWERWIRE_HIGH"
|
||||||
16;16;WIRE_ETHERNET;network;10base2;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,7,4;1;"ETHERNETWIRE"
|
16;16;WIRE_ETHERNET;network;10base2;3;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceSignalWire;basegame.items,7,4;1;"ETHERNETWIRE"
|
||||||
|
|
||||||
256;256;AXLE;axle;axle;1;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceAxle;basegame.items,1,5;0;"AXLE"
|
#256;256;AXLE;axle;axle;1;N/A;N/A;net.torvald.terrarum.modulebasegame.gameitems.WirePieceAxle;basegame.items,1,5;0;"AXLE"
|
||||||
|
|
||||||
# accept: which wiretype (defined elsewhere) the wires acceps. Use comma to separate multiple. N/A for electronic components (aka not wires)
|
# accept: which wiretype (defined elsewhere) the wires acceps. Use comma to separate multiple. N/A for electronic components (aka not wires)
|
||||||
# inputcount: how many sides are input (outputcount is deduced from the inputcount). N/A for wires
|
# inputcount: how many sides are input (outputcount is deduced from the inputcount). N/A for wires
|
||||||
|
|||||||
|
@@ -38,6 +38,7 @@ import net.torvald.terrarum.modulebasegame.IngameRenderer;
|
|||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame;
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame;
|
||||||
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
|
import net.torvald.terrarum.modulebasegame.ui.ItemSlotImageFactory;
|
||||||
import net.torvald.terrarum.serialise.WriteConfig;
|
import net.torvald.terrarum.serialise.WriteConfig;
|
||||||
|
import net.torvald.terrarum.ui.BlurMgr;
|
||||||
import net.torvald.terrarum.ui.Toolkit;
|
import net.torvald.terrarum.ui.Toolkit;
|
||||||
import net.torvald.terrarum.utils.JsonFetcher;
|
import net.torvald.terrarum.utils.JsonFetcher;
|
||||||
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
|
import net.torvald.terrarum.worlddrawer.CreateTileAtlas;
|
||||||
@@ -52,12 +53,14 @@ import org.apache.commons.csv.CSVParser;
|
|||||||
import org.lwjgl.PointerBuffer;
|
import org.lwjgl.PointerBuffer;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
|
|
||||||
|
import javax.tools.Tool;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
import java.util.zip.Deflater;
|
||||||
|
|
||||||
import static java.lang.Thread.MAX_PRIORITY;
|
import static java.lang.Thread.MAX_PRIORITY;
|
||||||
import static net.torvald.terrarum.TerrarumKt.*;
|
import static net.torvald.terrarum.TerrarumKt.*;
|
||||||
@@ -764,7 +767,7 @@ public class App implements ApplicationListener {
|
|||||||
FrameBufferManager.begin(fb);
|
FrameBufferManager.begin(fb);
|
||||||
try {
|
try {
|
||||||
Pixmap p = Pixmap.createFromFrameBuffer(0, 0, fb.getWidth(), fb.getHeight());
|
Pixmap p = Pixmap.createFromFrameBuffer(0, 0, fb.getWidth(), fb.getHeight());
|
||||||
PixmapIO.writePNG(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".png"), p, 9, true);
|
PixmapIO.writePNG(Gdx.files.absolute(defaultDir+"/Screenshot-"+String.valueOf(System.currentTimeMillis())+".png"), p, Deflater.DEFAULT_COMPRESSION, true);
|
||||||
p.dispose();
|
p.dispose();
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
@@ -1026,6 +1029,9 @@ public class App implements ApplicationListener {
|
|||||||
|
|
||||||
deleteTempfiles();
|
deleteTempfiles();
|
||||||
|
|
||||||
|
Toolkit.INSTANCE.dispose();
|
||||||
|
BlurMgr.INSTANCE.dispose();
|
||||||
|
|
||||||
disposables.forEach((it) -> {
|
disposables.forEach((it) -> {
|
||||||
try {
|
try {
|
||||||
it.dispose();
|
it.dispose();
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ object CheckUpdate {
|
|||||||
private val checkUpdateURL = setOf(
|
private val checkUpdateURL = setOf(
|
||||||
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumOnly",
|
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumOnly",
|
||||||
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumFull",
|
"https://github.com/curioustorvald/Terrarum/releases/tag/v$versionNumFull",
|
||||||
).toList()
|
).map { it.replace(' ', '_') }
|
||||||
|
|
||||||
private fun wget(url: String): String? {
|
private fun wget(url: String): String? {
|
||||||
printdbg(this, "wget $url")
|
printdbg(this, "wget $url")
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ basegame
|
|||||||
* e.g. 0x02010034 will be translated as 2.1.52
|
* e.g. 0x02010034 will be translated as 2.1.52
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
const val VERSION_RAW: Long = 0x0000_000004_000004
|
const val VERSION_RAW: Long = 0x0000_000005_000001
|
||||||
// Commit counts up to the Release 0.3.0: 2259
|
// Commit counts up to the Release 0.3.0: 2259
|
||||||
// Commit counts up to the Release 0.3.1: 2278
|
// Commit counts up to the Release 0.3.1: 2278
|
||||||
// Commit counts up to the Release 0.3.2: 2732
|
// Commit counts up to the Release 0.3.2: 2732
|
||||||
@@ -77,6 +77,8 @@ basegame
|
|||||||
// Commit counts up to the Release 0.4.0: 3631
|
// Commit counts up to the Release 0.4.0: 3631
|
||||||
// Commit counts up to the Release 0.4.1: 3678
|
// Commit counts up to the Release 0.4.1: 3678
|
||||||
// Commit counts up to the Release 0.4.2: 3762
|
// Commit counts up to the Release 0.4.2: 3762
|
||||||
|
// Commit counts up to the Release 0.5.0: 4090
|
||||||
|
// Commit counts up to the Release 0.5.1: 4097
|
||||||
|
|
||||||
val DEV_CYCLE: Map<String, Long> = mapOf(
|
val DEV_CYCLE: Map<String, Long> = mapOf(
|
||||||
"Alpha" to 0x0000_000004_000000,
|
"Alpha" to 0x0000_000004_000000,
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas
|
|||||||
batchDrawCol.a = openness
|
batchDrawCol.a = openness
|
||||||
batch.color = batchDrawCol
|
batch.color = batchDrawCol
|
||||||
if (App.getConfigBoolean("fx_backgroundblur")) {
|
if (App.getConfigBoolean("fx_backgroundblur")) {
|
||||||
Toolkit.blurEntireScreen(batch, camera as OrthographicCamera, blurRadius * openness, 0, 0, width, height)
|
Toolkit.blurEntireScreen(batch, blurRadius * openness, 0, 0, width, height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nodarken) {
|
if (!nodarken) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class SavegameCracker(
|
|||||||
private val cmds: HashMap<String, KFunction<*>> = HashMap()
|
private val cmds: HashMap<String, KFunction<*>> = HashMap()
|
||||||
init {
|
init {
|
||||||
SavegameCracker::class.declaredFunctions
|
SavegameCracker::class.declaredFunctions
|
||||||
.filter { it.findAnnotation<Command>() != null }
|
.filter { it.findAnnotation<SavegameCrackerCommand>() != null }
|
||||||
// .forEach { it.isAccessible = true; cmds[it.name] = it }
|
// .forEach { it.isAccessible = true; cmds[it.name] = it }
|
||||||
.forEach { cmds[it.name] = it }
|
.forEach { cmds[it.name] = it }
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ class SavegameCracker(
|
|||||||
printerrln("${args[0]}: command not found")
|
printerrln("${args[0]}: command not found")
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
val annot = it.findAnnotation<Command>()!!
|
val annot = it.findAnnotation<SavegameCrackerCommand>()!!
|
||||||
// check arguments
|
// check arguments
|
||||||
val synopsis = annot.synopsis.split(' ').filter { it.isNotBlank() }
|
val synopsis = annot.synopsis.split(' ').filter { it.isNotBlank() }
|
||||||
// print out synopsis
|
// print out synopsis
|
||||||
@@ -185,14 +185,14 @@ class SavegameCracker(
|
|||||||
return this + sb.toString()
|
return this + sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Loads a disk archive", "path-to-file")
|
@SavegameCrackerCommand("Loads a disk archive", "path-to-file")
|
||||||
fun load(args: List<String>) {
|
fun load(args: List<String>) {
|
||||||
file = File(args[1])
|
file = File(args[1])
|
||||||
disk = VDUtil.readDiskArchive(file!!, Level.INFO) { printerrln("# Warning: $it") }
|
disk = VDUtil.readDiskArchive(file!!, Level.INFO) { printerrln("# Warning: $it") }
|
||||||
file!!.copyTo(File(file!!.absolutePath + ".bak"), true)
|
file!!.copyTo(File(file!!.absolutePath + ".bak"), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Lists contents of the disk")
|
@SavegameCrackerCommand("Lists contents of the disk")
|
||||||
fun ls(args: List<String>) {
|
fun ls(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
it.entries.toSortedMap().forEach { (i, entry) ->
|
it.entries.toSortedMap().forEach { (i, entry) ->
|
||||||
@@ -207,19 +207,19 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Prints out available commands and their usage")
|
@SavegameCrackerCommand("Prints out available commands and their usage")
|
||||||
fun help(args: List<String>) {
|
fun help(args: List<String>) {
|
||||||
cmds.forEach { name, it ->
|
cmds.forEach { name, it ->
|
||||||
println("$ccNoun${name.padStart(8)}$cc0 - ${it.findAnnotation<Command>()!!.help}")
|
println("$ccNoun${name.padStart(8)}$cc0 - ${it.findAnnotation<SavegameCrackerCommand>()!!.help}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Exits the program")
|
@SavegameCrackerCommand("Exits the program")
|
||||||
fun exit(args: List<String>) { this.exit = true }
|
fun exit(args: List<String>) { this.exit = true }
|
||||||
@Command("Exits the program")
|
@SavegameCrackerCommand("Exits the program")
|
||||||
fun quit(args: List<String>) = exit(args)
|
fun quit(args: List<String>) = exit(args)
|
||||||
|
|
||||||
@Command("Exports contents of the entry into a real file", "entry-id output-file")
|
@SavegameCrackerCommand("Exports contents of the entry into a real file", "entry-id output-file")
|
||||||
fun export(args: List<String>) {
|
fun export(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
val entryID = args[1].toLong(10)
|
val entryID = args[1].toLong(10)
|
||||||
@@ -228,7 +228,7 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Changes one entry-ID into another", "change-from change-to")
|
@SavegameCrackerCommand("Changes one entry-ID into another", "change-from change-to")
|
||||||
fun renum(args: List<String>) {
|
fun renum(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
val id0 = args[1].toLong(10)
|
val id0 = args[1].toLong(10)
|
||||||
@@ -244,7 +244,7 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Imports a real file onto the savefile", "input-file entry-id")
|
@SavegameCrackerCommand("Imports a real file onto the savefile", "input-file entry-id")
|
||||||
fun import(args: List<String>) {
|
fun import(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
val file = File(args[1])
|
val file = File(args[1])
|
||||||
@@ -257,7 +257,7 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Removes a file within the savefile", "entry-id")
|
@SavegameCrackerCommand("Removes a file within the savefile", "entry-id")
|
||||||
fun rm(args: List<String>) {
|
fun rm(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
val id = args[1].toLong(10)
|
val id = args[1].toLong(10)
|
||||||
@@ -266,14 +266,14 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Saves changes onto the savefile")
|
@SavegameCrackerCommand("Saves changes onto the savefile")
|
||||||
fun save(args: List<String>) {
|
fun save(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
VDUtil.dumpToRealMachine(it, file!!)
|
VDUtil.dumpToRealMachine(it, file!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Retrieves all UUIDs found (player UUID, current world UUID, etc.")
|
@SavegameCrackerCommand("Retrieves all UUIDs found (player UUID, current world UUID, etc.")
|
||||||
fun uuid(args: List<String>) {
|
fun uuid(args: List<String>) {
|
||||||
letdisk {
|
letdisk {
|
||||||
val jsonFile = it.getFile(-1) ?: throw FileNotFoundException("savegameinfo.json (entry ID -1) not found")
|
val jsonFile = it.getFile(-1) ?: throw FileNotFoundException("savegameinfo.json (entry ID -1) not found")
|
||||||
@@ -294,7 +294,7 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command("Removes the specified chunk(s) completely", "IDs")
|
@SavegameCrackerCommand("Removes the specified chunk(s) completely", "IDs")
|
||||||
fun discardchunk(args: List<String>) {
|
fun discardchunk(args: List<String>) {
|
||||||
letdisk { disk ->
|
letdisk { disk ->
|
||||||
val ids = args[1]
|
val ids = args[1]
|
||||||
@@ -320,7 +320,7 @@ class SavegameCracker(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal annotation class Command(val help: String = "", val synopsis: String = "")
|
internal annotation class SavegameCrackerCommand(val help: String = "", val synopsis: String = "")
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
SavegameCracker(args).invoke()
|
SavegameCracker(args).invoke()
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const val FLUID_MIN_MASS = 1f / 1024f //Ignore cells that are almost dry (smalle
|
|||||||
*
|
*
|
||||||
* Created by minjaesong on 2023-10-10.
|
* Created by minjaesong on 2023-10-10.
|
||||||
*/
|
*/
|
||||||
class BlockLayerI16F16(override val width: Int, override val height: Int) : BlockLayer {
|
class BlockLayerFluidI16F16(override val width: Int, override val height: Int) : BlockLayer {
|
||||||
override val bytesPerBlock = BYTES_PER_BLOCK
|
override val bytesPerBlock = BYTES_PER_BLOCK
|
||||||
|
|
||||||
// for some reason, all the efforts of saving the memory space were futile.
|
// for some reason, all the efforts of saving the memory space were futile.
|
||||||
|
|||||||
@@ -21,19 +21,10 @@ import net.torvald.unsafe.UnsafePtr
|
|||||||
*
|
*
|
||||||
* Note to self: refrain from using shorts--just do away with two bytes: different system have different endianness
|
* Note to self: refrain from using shorts--just do away with two bytes: different system have different endianness
|
||||||
*/
|
*/
|
||||||
class BlockLayerI16(
|
class BlockLayerGenericI16(
|
||||||
override val width: Int,
|
override val width: Int,
|
||||||
override val height: Int,
|
override val height: Int,
|
||||||
disk: ClusteredFormatDOM,
|
): BlockLayer {
|
||||||
layerNum: Int,
|
|
||||||
world: GameWorld
|
|
||||||
): BlockLayer() {
|
|
||||||
|
|
||||||
override val chunkPool = ChunkPool(disk, layerNum, BYTES_PER_BLOCK, world, when (layerNum) {
|
|
||||||
TERRAIN -> ChunkPool.getRenameFunTerrain(world)
|
|
||||||
WALL -> ChunkPool.getRenameFunTerrain(world)
|
|
||||||
else -> throw IllegalArgumentException("Unknown layer number for I16: $layerNum")
|
|
||||||
})
|
|
||||||
|
|
||||||
override val bytesPerBlock = BYTES_PER_BLOCK
|
override val bytesPerBlock = BYTES_PER_BLOCK
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
|||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZEF
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.blockproperties.FluidCodex
|
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.METER
|
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.METER
|
||||||
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.PHYS_EPSILON_DIST
|
import net.torvald.terrarum.gameactors.ActorWithBody.Companion.PHYS_EPSILON_DIST
|
||||||
@@ -32,6 +31,7 @@ import net.torvald.terrarum.gameworld.fmod
|
|||||||
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
import net.torvald.terrarum.modulebasegame.gameactors.Pocketed
|
||||||
import net.torvald.terrarum.modulebasegame.gameitems.ItemThrowable
|
import net.torvald.terrarum.modulebasegame.gameitems.ItemThrowable
|
||||||
import net.torvald.terrarum.modulebasegame.gameitems.getThrowPosAndVector
|
import net.torvald.terrarum.modulebasegame.gameitems.getThrowPosAndVector
|
||||||
|
import net.torvald.terrarum.ui.BlurMgr
|
||||||
import net.torvald.terrarum.ui.Toolkit
|
import net.torvald.terrarum.ui.Toolkit
|
||||||
import net.torvald.terrarum.weather.WeatherMixer
|
import net.torvald.terrarum.weather.WeatherMixer
|
||||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||||
@@ -75,6 +75,17 @@ object IngameRenderer : Disposable {
|
|||||||
private lateinit var fboA_lightMixed: Float16FrameBuffer
|
private lateinit var fboA_lightMixed: Float16FrameBuffer
|
||||||
private lateinit var fboEmissive: Float16FrameBuffer
|
private lateinit var fboEmissive: Float16FrameBuffer
|
||||||
private lateinit var fboMixedOut: Float16FrameBuffer
|
private lateinit var fboMixedOut: Float16FrameBuffer
|
||||||
|
|
||||||
|
private lateinit var fboRGBactorsBehind: Float16FrameBuffer // for small shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
private lateinit var fboRGBactorsMiddle: Float16FrameBuffer // for large shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
private lateinit var fboRGBterrain: Float16FrameBuffer // for large shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
|
||||||
|
private lateinit var fboRGBactorsBehindShadow: Float16FrameBuffer // for small shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
private lateinit var fboRGBactorsMiddleShadow: Float16FrameBuffer // for large shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
private lateinit var fboRGBterrainShadow: Float16FrameBuffer // for large shadow eff; A channel is for glow effects so they don't get shadow effects
|
||||||
|
|
||||||
|
private lateinit var fboRGBwall: Float16FrameBuffer // for masking away the shadows
|
||||||
|
|
||||||
private lateinit var rgbTex: TextureRegion
|
private lateinit var rgbTex: TextureRegion
|
||||||
private lateinit var aTex: TextureRegion
|
private lateinit var aTex: TextureRegion
|
||||||
private lateinit var mixedOutTex: TextureRegion
|
private lateinit var mixedOutTex: TextureRegion
|
||||||
@@ -104,6 +115,8 @@ object IngameRenderer : Disposable {
|
|||||||
val shaderBlendGlow: ShaderProgram
|
val shaderBlendGlow: ShaderProgram
|
||||||
val shaderBlendGlowTex1Flip: ShaderProgram
|
val shaderBlendGlowTex1Flip: ShaderProgram
|
||||||
val shaderForActors: ShaderProgram
|
val shaderForActors: ShaderProgram
|
||||||
|
val shaderShadowShallow: ShaderProgram
|
||||||
|
val shaderShadowDeep: ShaderProgram
|
||||||
val shaderDemultiply: ShaderProgram
|
val shaderDemultiply: ShaderProgram
|
||||||
|
|
||||||
val shaderBayerAlpha: ShaderProgram
|
val shaderBayerAlpha: ShaderProgram
|
||||||
@@ -146,6 +159,8 @@ object IngameRenderer : Disposable {
|
|||||||
|
|
||||||
|
|
||||||
shaderForActors = App.loadShaderFromClasspath("shaders/default.vert", "shaders/actors.frag")
|
shaderForActors = App.loadShaderFromClasspath("shaders/default.vert", "shaders/actors.frag")
|
||||||
|
shaderShadowShallow = App.loadShaderFromClasspath("shaders/default.vert", "shaders/shadowshallow.frag")
|
||||||
|
shaderShadowDeep = App.loadShaderFromClasspath("shaders/default.vert", "shaders/shadowdeep.frag")
|
||||||
shaderBlendGlow = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/blendGlow.frag")
|
shaderBlendGlow = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/blendGlow.frag")
|
||||||
shaderBlendGlowTex1Flip = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/blendGlowTex1Flip.frag")
|
shaderBlendGlowTex1Flip = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/blendGlowTex1Flip.frag")
|
||||||
shaderDemultiply = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/demultiply.frag")
|
shaderDemultiply = App.loadShaderFromClasspath("shaders/blendGlow.vert", "shaders/demultiply.frag")
|
||||||
@@ -497,10 +512,9 @@ object IngameRenderer : Disposable {
|
|||||||
fboRGB_lightMixed0.inAction(null, null) { clearBuffer() }
|
fboRGB_lightMixed0.inAction(null, null) { clearBuffer() }
|
||||||
fboRGB_lightMixed.inAction(null, null) { clearBuffer() }
|
fboRGB_lightMixed.inAction(null, null) { clearBuffer() }
|
||||||
|
|
||||||
fboRGB.inAction(camera, batch) {
|
fboRGBactorsBehind.inAction(camera, batch) {
|
||||||
|
clearBuffer()
|
||||||
setCameraPosition(0f, 0f)
|
setCameraPosition(0f, 0f)
|
||||||
BlocksDrawer.drawWall(batch.projectionMatrix, false)
|
|
||||||
|
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
batch.shader = shaderForActors
|
batch.shader = shaderForActors
|
||||||
@@ -508,21 +522,103 @@ object IngameRenderer : Disposable {
|
|||||||
moveCameraToWorldCoord()
|
moveCameraToWorldCoord()
|
||||||
actorsRenderFarBehind?.forEach { it.drawBody(frameDelta, batch) }
|
actorsRenderFarBehind?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
actorsRenderBehind?.forEach { it.drawBody(frameDelta, batch) }
|
actorsRenderBehind?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BlurMgr.makeBlur(fboRGBactorsBehind, fboRGBactorsBehindShadow, 0.25f)
|
||||||
|
|
||||||
|
fboRGBactorsMiddle.inAction(camera, batch) {
|
||||||
|
clearBuffer()
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
|
||||||
|
batch.inUse {
|
||||||
|
batch.shader = shaderForActors
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
moveCameraToWorldCoord()
|
||||||
|
actorsRenderMiddle?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BlurMgr.makeBlur(fboRGBactorsMiddle, fboRGBactorsMiddleShadow, 2.5f)
|
||||||
|
|
||||||
|
fboRGBwall.inAction(camera, batch) {
|
||||||
|
clearBuffer()
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
BlocksDrawer.drawWall(batch.projectionMatrix, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
fboRGBterrain.inAction(camera, batch) {
|
||||||
|
clearBuffer()
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
BlocksDrawer.drawTerrain(batch.projectionMatrix, false)
|
||||||
|
}
|
||||||
|
BlurMgr.makeBlur(fboRGBterrain, fboRGBterrainShadow, 2.5f)
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
fboRGB.inAction(camera, batch) {
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
|
||||||
|
batch.inUse {
|
||||||
|
batch.shader = null
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.drawFlipped(fboRGBwall.colorBufferTexture, 0f, 0f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw actor shadow BEFORE the terrain draw
|
||||||
|
fboRGBwall.colorBufferTexture.bind(1)
|
||||||
|
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||||
|
|
||||||
|
batch.inUse {
|
||||||
|
batch.shader = shaderShadowShallow
|
||||||
|
shaderShadowShallow.setUniformi("u_wall", 1)
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
batch.drawFlipped(fboRGBactorsBehindShadow.colorBufferTexture, 0f, 0f)
|
||||||
|
}
|
||||||
|
|
||||||
|
fboRGBwall.colorBufferTexture.bind(1)
|
||||||
|
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||||
|
|
||||||
|
batch.inUse {
|
||||||
|
batch.shader = shaderShadowDeep
|
||||||
|
shaderShadowDeep.setUniformi("u_wall", 1)
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
batch.drawFlipped(fboRGBterrainShadow.colorBufferTexture, 0f, 0f)
|
||||||
|
batch.drawFlipped(fboRGBactorsMiddleShadow.colorBufferTexture, 0f, 0f)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gdx.gl20.glActiveTexture(0)
|
||||||
|
|
||||||
|
// draw behind actors and particles
|
||||||
|
batch.inUse {
|
||||||
|
batch.shader = shaderForActors
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.drawFlipped(fboRGBactorsBehind.colorBufferTexture, 0f, 0f)
|
||||||
|
|
||||||
|
moveCameraToWorldCoord()
|
||||||
particlesContainer?.forEach { it.drawBody(frameDelta, batch) }
|
particlesContainer?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
}
|
}
|
||||||
|
|
||||||
setCameraPosition(0f, 0f)
|
// draw just the terrain
|
||||||
BlocksDrawer.drawTerrain(batch.projectionMatrix, false)
|
batch.inUse {
|
||||||
|
batch.shader = null
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.drawFlipped(fboRGBterrain.colorBufferTexture, 0f, 0f)
|
||||||
|
}
|
||||||
|
|
||||||
batch.shader = shaderForActors
|
|
||||||
batch.inUse {
|
batch.inUse {
|
||||||
batch.shader = shaderForActors
|
batch.shader = shaderForActors
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
/////////////////
|
/////////////////
|
||||||
// draw actors //
|
// draw actors //
|
||||||
/////////////////
|
/////////////////
|
||||||
|
setCameraPosition(0f, 0f)
|
||||||
|
batch.color = Color.WHITE
|
||||||
|
batch.drawFlipped(fboRGBactorsMiddle.colorBufferTexture, 0f, 0f)
|
||||||
|
|
||||||
moveCameraToWorldCoord()
|
moveCameraToWorldCoord()
|
||||||
actorsRenderMiddle?.forEach { it.drawBody(frameDelta, batch) }
|
|
||||||
actorsRenderMidTop?.forEach { it.drawBody(frameDelta, batch) }
|
actorsRenderMidTop?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
player?.drawBody(frameDelta, batch)
|
player?.drawBody(frameDelta, batch)
|
||||||
actorsRenderFront?.forEach { it.drawBody(frameDelta, batch) }
|
actorsRenderFront?.forEach { it.drawBody(frameDelta, batch) }
|
||||||
@@ -1209,6 +1305,13 @@ object IngameRenderer : Disposable {
|
|||||||
fboA_lightMixed = Float16FrameBuffer(width, height, false)
|
fboA_lightMixed = Float16FrameBuffer(width, height, false)
|
||||||
fboEmissive = Float16FrameBuffer(width, height, false)
|
fboEmissive = Float16FrameBuffer(width, height, false)
|
||||||
fboMixedOut = Float16FrameBuffer(width, height, false)
|
fboMixedOut = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBactorsBehind = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBactorsMiddle = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBterrain = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBactorsBehindShadow = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBactorsMiddleShadow = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBterrainShadow = Float16FrameBuffer(width, height, false)
|
||||||
|
fboRGBwall = Float16FrameBuffer(width, height, false)
|
||||||
lightmapFbo = Float16FrameBuffer(
|
lightmapFbo = Float16FrameBuffer(
|
||||||
LightmapRenderer.lightBuffer.width * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
LightmapRenderer.lightBuffer.width * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||||
LightmapRenderer.lightBuffer.height * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
LightmapRenderer.lightBuffer.height * LightmapRenderer.DRAW_TILE_SIZE.toInt(),
|
||||||
@@ -1271,6 +1374,13 @@ object IngameRenderer : Disposable {
|
|||||||
if (::fboEmissive.isInitialized) fboEmissive.tryDispose()
|
if (::fboEmissive.isInitialized) fboEmissive.tryDispose()
|
||||||
if (::fboMixedOut.isInitialized) fboMixedOut.tryDispose()
|
if (::fboMixedOut.isInitialized) fboMixedOut.tryDispose()
|
||||||
if (::lightmapFbo.isInitialized) lightmapFbo.tryDispose()
|
if (::lightmapFbo.isInitialized) lightmapFbo.tryDispose()
|
||||||
|
if (::fboRGBactorsBehind.isInitialized) fboRGBactorsBehind.tryDispose()
|
||||||
|
if (::fboRGBactorsMiddle.isInitialized) fboRGBactorsMiddle.tryDispose()
|
||||||
|
if (::fboRGBterrain.isInitialized) fboRGBterrain.tryDispose()
|
||||||
|
if (::fboRGBactorsBehindShadow.isInitialized) fboRGBactorsBehindShadow.tryDispose()
|
||||||
|
if (::fboRGBactorsMiddleShadow.isInitialized) fboRGBactorsMiddleShadow.tryDispose()
|
||||||
|
if (::fboRGBterrainShadow.isInitialized) fboRGBterrainShadow.tryDispose()
|
||||||
|
if (::fboRGBwall.isInitialized) fboRGBwall.tryDispose()
|
||||||
|
|
||||||
blurtex0.tryDispose()
|
blurtex0.tryDispose()
|
||||||
|
|
||||||
@@ -1294,6 +1404,8 @@ object IngameRenderer : Disposable {
|
|||||||
shaderBlendGlow.dispose()
|
shaderBlendGlow.dispose()
|
||||||
shaderBlendGlowTex1Flip.dispose()
|
shaderBlendGlowTex1Flip.dispose()
|
||||||
shaderForActors.dispose()
|
shaderForActors.dispose()
|
||||||
|
shaderShadowShallow.dispose()
|
||||||
|
shaderShadowDeep.dispose()
|
||||||
shaderDemultiply.dispose()
|
shaderDemultiply.dispose()
|
||||||
|
|
||||||
shaderBayerAlpha.dispose()
|
shaderBayerAlpha.dispose()
|
||||||
|
|||||||
142
src/net/torvald/terrarum/modulebasegame/console/ExportFBO.kt
Normal file
142
src/net/torvald/terrarum/modulebasegame/console/ExportFBO.kt
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.console
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
|
import com.badlogic.gdx.graphics.GL20
|
||||||
|
import com.badlogic.gdx.graphics.GL30
|
||||||
|
import com.badlogic.gdx.graphics.Pixmap
|
||||||
|
import com.badlogic.gdx.graphics.PixmapIO
|
||||||
|
import com.badlogic.gdx.graphics.glutils.Float16FrameBuffer
|
||||||
|
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||||
|
import com.badlogic.gdx.utils.BufferUtils
|
||||||
|
import net.torvald.reflection.extortField
|
||||||
|
import net.torvald.terrarum.App
|
||||||
|
import net.torvald.terrarum.ccG
|
||||||
|
import net.torvald.terrarum.ccO
|
||||||
|
import net.torvald.terrarum.ccW
|
||||||
|
import net.torvald.terrarum.console.ConsoleCommand
|
||||||
|
import net.torvald.terrarum.console.Echo
|
||||||
|
import net.torvald.terrarum.console.EchoError
|
||||||
|
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||||
|
import net.torvald.unicode.BULLET
|
||||||
|
import net.torvald.unicode.EMDASH
|
||||||
|
import java.nio.ByteBuffer
|
||||||
|
import java.util.zip.Deflater
|
||||||
|
import kotlin.reflect.KFunction
|
||||||
|
import kotlin.reflect.full.declaredFunctions
|
||||||
|
import kotlin.reflect.full.findAnnotation
|
||||||
|
import kotlin.reflect.full.hasAnnotation
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-11-24.
|
||||||
|
*/
|
||||||
|
internal object ExportFBO : ConsoleCommand {
|
||||||
|
|
||||||
|
private val cmds: HashMap<String, KFunction<*>> = HashMap()
|
||||||
|
private val helpMessages: List<Pair<String, String>>
|
||||||
|
|
||||||
|
init {
|
||||||
|
val helpMsgs: HashMap<String, String> = HashMap()
|
||||||
|
|
||||||
|
ExportFBO::class.declaredFunctions.filter { it.hasAnnotation<ExportFBOCmd>() }.forEach {
|
||||||
|
cmds[it.name.lowercase()] = it
|
||||||
|
helpMsgs[it.name.lowercase()] = it.findAnnotation<ExportFBOCmd>()!!.description
|
||||||
|
}
|
||||||
|
|
||||||
|
helpMessages = helpMsgs.keys.toList().sorted().map {
|
||||||
|
it to helpMsgs[it]!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun execute(args: Array<String>) {
|
||||||
|
if (args.size != 3) { printUsage(); return }
|
||||||
|
val fn = cmds[args[1].lowercase()]
|
||||||
|
if (fn == null) { printUsage(); return }
|
||||||
|
|
||||||
|
try {
|
||||||
|
val filename = "${args[2]}-${args[1]}.png"
|
||||||
|
val fileHandle = Gdx.files.absolute("${App.defaultDir}/Exports/$filename")
|
||||||
|
|
||||||
|
val fbo = fn.call(this) as FrameBuffer
|
||||||
|
|
||||||
|
// cannot use createFromFrameBuffer because the specific FBO must be bound in a way we can control
|
||||||
|
val pixels: ByteBuffer = BufferUtils.newByteBuffer(fbo.width * fbo.height * 4)
|
||||||
|
Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fbo.framebufferHandle)
|
||||||
|
Gdx.gl.glReadPixels(0, 0, fbo.width, fbo.height, GL30.GL_RGBA, GL30.GL_UNSIGNED_BYTE, pixels)
|
||||||
|
Gdx.gl.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0)
|
||||||
|
|
||||||
|
val pixmap: Pixmap = Pixmap(fbo.width, fbo.height, Pixmap.Format.RGBA8888)
|
||||||
|
BufferUtils.copy(pixels, pixmap.pixels, pixels.capacity())
|
||||||
|
|
||||||
|
PixmapIO.writePNG(fileHandle, pixmap, Deflater.DEFAULT_COMPRESSION, true)
|
||||||
|
|
||||||
|
Echo("Framebuffer exported to$ccG Exports/$filename")
|
||||||
|
}
|
||||||
|
catch (e: Throwable) {
|
||||||
|
EchoError("Could not retrieve the framebuffer: ${e.message}")
|
||||||
|
System.err.println(e)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun printUsage() {
|
||||||
|
Echo("Usage: exportfbo <identifier> <filename without extension>")
|
||||||
|
Echo("Available identifiers are:")
|
||||||
|
|
||||||
|
helpMessages.forEach { (name, desc) ->
|
||||||
|
Echo(" $BULLET $ccG$name $ccW$EMDASH $ccO$desc")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Main RGB channel of the IngameRenderer without lighting")
|
||||||
|
fun fborgb(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGB")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Main A channel of the IngameRenderer without lighting")
|
||||||
|
fun fboa(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboA")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Main Emissive channel of the IngameRenderer without lighting")
|
||||||
|
fun fboemissive(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboEmissive")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for render-behind actors used for creating shallow shadow effects")
|
||||||
|
fun fborgbactorsbehind(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBactorsBehind")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for render-middle actors used for creating large shadow effects")
|
||||||
|
fun fborgbactorsmiddle(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBactorsMiddle")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for terrain blocks used for creating large shadow effects")
|
||||||
|
fun fborgbterrain(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBterrain")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for render-behind actors used for creating shallow shadow effects")
|
||||||
|
fun fborgbactorsbehindshadow(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBactorsBehindShadow")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for render-middle actors used for creating large shadow effects")
|
||||||
|
fun fborgbactorsmiddleshadow(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBactorsMiddleShadow")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for terrain blocks used for creating large shadow effects")
|
||||||
|
fun fborgbterrainshadow(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBterrainShadow")!!
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExportFBOCmd("Framebuffer for wall blocks")
|
||||||
|
fun fborgbwall(): FrameBuffer {
|
||||||
|
return IngameRenderer.extortField<Float16FrameBuffer>("fboRGBwall")!!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal annotation class ExportFBOCmd(val description: String)
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.gameactors
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.gameactors.ActorID
|
import net.torvald.terrarum.gameactors.ActorID
|
||||||
import net.torvald.terrarum.gameactors.PhysProperties
|
import net.torvald.terrarum.gameactors.PhysProperties
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -16,7 +17,7 @@ open class Electric : FixtureBase {
|
|||||||
|
|
||||||
protected constructor() : super() {
|
protected constructor() : super() {
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +46,7 @@ open class Electric : FixtureBase {
|
|||||||
App.disposables.add(mainUI)
|
App.disposables.add(mainUI)
|
||||||
|
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -137,7 +138,7 @@ open class Electric : FixtureBase {
|
|||||||
getWireEmissionAt(offsetX, offsetY).x <= ELECTRIC_THRESHOLD_LOW
|
getWireEmissionAt(offsetX, offsetY).x <= ELECTRIC_THRESHOLD_LOW
|
||||||
|
|
||||||
protected var oldSinkStatus: Array<Vector2>
|
protected var oldSinkStatus: Array<Vector2>
|
||||||
protected var newSinkStatus: Array<Vector2>
|
// protected var newSinkStatus: Array<Vector2>
|
||||||
|
|
||||||
open fun updateOnWireGraphTraversal(offsetX: Int, offsetY: Int, sinkType: WireEmissionType) {
|
open fun updateOnWireGraphTraversal(offsetX: Int, offsetY: Int, sinkType: WireEmissionType) {
|
||||||
val index = pointToBlockBoxIndex(offsetX, offsetY)
|
val index = pointToBlockBoxIndex(offsetX, offsetY)
|
||||||
@@ -149,9 +150,6 @@ open class Electric : FixtureBase {
|
|||||||
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
oldSinkStatus[index].set(new2)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -167,35 +165,35 @@ open class Electric : FixtureBase {
|
|||||||
for (x in 0 until blockBox.width) {
|
for (x in 0 until blockBox.width) {
|
||||||
// get indices of "rising edges"
|
// get indices of "rising edges"
|
||||||
// get indices of "falling edges"
|
// get indices of "falling edges"
|
||||||
|
|
||||||
val wx = x + worldBlockPos!!.x
|
|
||||||
val wy = y + worldBlockPos!!.y
|
|
||||||
val new = WireCodex.getAllWiresThatAccepts(getWireSinkAt(x, y) ?: "").fold(Vector2()) { acc, (id, _) ->
|
|
||||||
INGAME.world.getWireEmitStateOf(wx, wy, id).let {
|
|
||||||
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val index = pointToBlockBoxIndex(x, y)
|
val index = pointToBlockBoxIndex(x, y)
|
||||||
|
val type = getWireSinkAt(index) ?: ""
|
||||||
|
|
||||||
if (new.x - oldSinkStatus[index].x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
|
if (type.isNotBlank()) {
|
||||||
risingEdgeIndices.add(index)
|
val old = oldSinkStatus[index]
|
||||||
else if (oldSinkStatus[index].x - new.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x <= ELECTRIC_THRESHOLD_LOW)
|
val new = getWireStateAt(x, y, type)
|
||||||
fallingEdgeIndices.add(index)
|
|
||||||
|
val wx = x + worldBlockPos!!.x
|
||||||
|
val wy = y + worldBlockPos!!.y
|
||||||
|
|
||||||
|
// println("Wxy($wx,$wy) getWireState($type)=$new, oldState($type)=$old")
|
||||||
|
|
||||||
|
if (new.x - old.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
|
||||||
|
risingEdgeIndices.add(index)
|
||||||
|
else if (old.x - new.x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x <= ELECTRIC_THRESHOLD_LOW)
|
||||||
|
fallingEdgeIndices.add(index)
|
||||||
|
|
||||||
|
|
||||||
oldSinkStatus[index].set(new)
|
oldSinkStatus[index].set(new)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (risingEdgeIndices.isNotEmpty()) {
|
||||||
|
// println("risingEdgeIndices=$risingEdgeIndices")
|
||||||
|
// }
|
||||||
|
|
||||||
risingEdgeIndices.forEach { onRisingEdge(it) }
|
risingEdgeIndices.forEach { onRisingEdge(it) }
|
||||||
fallingEdgeIndices.forEach { onFallingEdge(it) }
|
fallingEdgeIndices.forEach { onFallingEdge(it) }
|
||||||
updateSignal()
|
updateSignal()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*oldSinkStatus.indices.forEach { index ->
|
|
||||||
oldSinkStatus[index].set(new)
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,11 +14,12 @@ import org.dyn4j.geometry.Vector2
|
|||||||
*/
|
*/
|
||||||
class FixtureLogicSignalAdder : Electric, Reorientable {
|
class FixtureLogicSignalAdder : Electric, Reorientable {
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 2, 2),
|
BlockBox(BlockBox.NO_COLLISION, 2, 2),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_ADDER"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_ADDER"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -34,11 +34,12 @@ interface Reorientable {
|
|||||||
*/
|
*/
|
||||||
class FixtureLogicSignalBlocker : Electric, Reorientable {
|
class FixtureLogicSignalBlocker : Electric, Reorientable {
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 2, 2),
|
BlockBox(BlockBox.NO_COLLISION, 2, 2),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_BLOCKER"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_BLOCKER"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class FixtureLogicSignalBulb : Electric {
|
|||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_COPPER_BULB"] }
|
nameFun = { Lang["ITEM_COPPER_BULB"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ import org.dyn4j.geometry.Vector2
|
|||||||
*/
|
*/
|
||||||
class FixtureLogicSignalLatch : Electric, Reorientable {
|
class FixtureLogicSignalLatch : Electric, Reorientable {
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 2, 3),
|
BlockBox(BlockBox.NO_COLLISION, 2, 3),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_LATCH"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_LATCH"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ import org.dyn4j.geometry.Vector2
|
|||||||
class FixtureLogicSignalRepeaterHorz : Electric, Reorientable {
|
class FixtureLogicSignalRepeaterHorz : Electric, Reorientable {
|
||||||
|
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 2, 1),
|
BlockBox(BlockBox.NO_COLLISION, 2, 1),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_REPEATER"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_REPEATER"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,12 @@ import org.dyn4j.geometry.Vector2
|
|||||||
*/
|
*/
|
||||||
class FixtureLogicSignalSwitchManual : Electric {
|
class FixtureLogicSignalSwitchManual : Electric {
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_SWITCH"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_SWITCH"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,11 +75,12 @@ class FixtureLogicSignalSwitchManual : Electric {
|
|||||||
*/
|
*/
|
||||||
class FixtureLogicSignalPushbutton : Electric {
|
class FixtureLogicSignalPushbutton : Electric {
|
||||||
|
|
||||||
@Transient override val spawnNeedsFloor = true
|
@Transient override val spawnNeedsFloor = false
|
||||||
@Transient override val spawnNeedsWall = true
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
||||||
|
renderOrder = RenderOrder.BEHIND,
|
||||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_PUSHBUTTON"] }
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_PUSHBUTTON"] }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class FixtureTextSignCopper : Electric {
|
|||||||
blockBox = BlockBox(BlockBox.NO_COLLISION, panelCount, 2)
|
blockBox = BlockBox(BlockBox.NO_COLLISION, panelCount, 2)
|
||||||
setHitboxDimension(TILE_SIZE * blockBox.width, TILE_SIZE * blockBox.height, 0, 2)
|
setHitboxDimension(TILE_SIZE * blockBox.width, TILE_SIZE * blockBox.height, 0, 2)
|
||||||
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
oldSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
// newSinkStatus = Array(blockBox.width * blockBox.height) { Vector2() }
|
||||||
}
|
}
|
||||||
|
|
||||||
// must be re-spawned on reload to make it visible after load
|
// must be re-spawned on reload to make it visible after load
|
||||||
|
|||||||
@@ -62,10 +62,12 @@ class FixtureWorldPortal : Electric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
||||||
|
// printdbg(this, "readFrom=$readFrom; getWireSinkAt(readFrom)=${getWireSinkAt(readFrom)}")
|
||||||
|
|
||||||
if (getWireSinkAt(readFrom) != "digital_bit") return
|
if (getWireSinkAt(readFrom) != "digital_bit") return
|
||||||
|
|
||||||
|
|
||||||
printdbg(this, "teleport! $teleportRequest")
|
// printdbg(this, "teleport! $teleportRequest")
|
||||||
teleportRequest?.let {
|
teleportRequest?.let {
|
||||||
if (it.worldDiskToLoad != null && it.worldLoadParam != null) {
|
if (it.worldDiskToLoad != null && it.worldLoadParam != null) {
|
||||||
throw InternalError("Contradiction -- worldDiskToLoad and worldLoadParam are both not null: $teleportRequest")
|
throw InternalError("Contradiction -- worldDiskToLoad and worldLoadParam are both not null: $teleportRequest")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class UICheatDetected : UICanvas() {
|
|||||||
Terrarum.ingame?.consoleHandler?.setAsClose()
|
Terrarum.ingame?.consoleHandler?.setAsClose()
|
||||||
Terrarum.ingame?.consoleHandler?.isVisible = false
|
Terrarum.ingame?.consoleHandler?.isVisible = false
|
||||||
|
|
||||||
Toolkit.blurEntireScreen(batch, camera as OrthographicCamera, 2f, 0, 0, width, height)
|
Toolkit.blurEntireScreen(batch, 2f, 0, 0, width, height)
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
Toolkit.fillArea(batch, 0f, 0f, width.toFloat(), height.toFloat())
|
Toolkit.fillArea(batch, 0f, 0f, width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ class UIPauseTheGame : UICanvas() {
|
|||||||
Terrarum.ingame?.consoleHandler?.setAsClose()
|
Terrarum.ingame?.consoleHandler?.setAsClose()
|
||||||
Terrarum.ingame?.consoleHandler?.isVisible = false
|
Terrarum.ingame?.consoleHandler?.isVisible = false
|
||||||
|
|
||||||
Toolkit.blurEntireScreen(batch, camera as OrthographicCamera, 2f, 0, 0, width, height)
|
Toolkit.blurEntireScreen(batch, 2f, 0, 0, width, height)
|
||||||
batch.color = backgroundCol
|
batch.color = backgroundCol
|
||||||
Toolkit.fillArea(batch, 0f, 0f, width.toFloat(), height.toFloat())
|
Toolkit.fillArea(batch, 0f, 0f, width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
clearTooltip()
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
seedInput.clearText()
|
seedInput.clearText()
|
||||||
seedInput.refreshPlaceholder()
|
seedInput.refreshPlaceholder()
|
||||||
|
|||||||
159
src/net/torvald/terrarum/ui/BlurMgr.kt
Normal file
159
src/net/torvald/terrarum/ui/BlurMgr.kt
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
package net.torvald.terrarum.ui
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.*
|
||||||
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import com.badlogic.gdx.graphics.glutils.Float16FrameBuffer
|
||||||
|
import com.badlogic.gdx.graphics.glutils.FrameBuffer
|
||||||
|
import com.jme3.math.FastMath
|
||||||
|
import net.torvald.terrarum.App
|
||||||
|
import net.torvald.terrarum.ceilToInt
|
||||||
|
import net.torvald.terrarum.gdxClearAndEnableBlend
|
||||||
|
import net.torvald.terrarum.inAction
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-11-23.
|
||||||
|
*/
|
||||||
|
object BlurMgr {
|
||||||
|
|
||||||
|
private class FrameBufferSet(val width: Int, val height: Int) {
|
||||||
|
private val internalWidth = (width.toFloat() / 4f).ceilToInt() * 4
|
||||||
|
private val internalHeight = (height.toFloat() / 4f).ceilToInt() * 4
|
||||||
|
|
||||||
|
val full = Float16FrameBuffer(width, height, false)
|
||||||
|
val half = Float16FrameBuffer(internalWidth / 2, internalHeight / 2, false)
|
||||||
|
val quarter = Float16FrameBuffer(internalWidth / 4, internalHeight / 4, false)
|
||||||
|
val camera = OrthographicCamera(width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
|
val quadFull = Mesh(
|
||||||
|
true, 4, 4,
|
||||||
|
VertexAttribute.Position(),
|
||||||
|
VertexAttribute.ColorUnpacked(),
|
||||||
|
VertexAttribute.TexCoords(0)
|
||||||
|
)
|
||||||
|
val quadHalf = Mesh(
|
||||||
|
true, 4, 4,
|
||||||
|
VertexAttribute.Position(),
|
||||||
|
VertexAttribute.ColorUnpacked(),
|
||||||
|
VertexAttribute.TexCoords(0)
|
||||||
|
)
|
||||||
|
val quadQuarter = Mesh(
|
||||||
|
true, 4, 4,
|
||||||
|
VertexAttribute.Position(),
|
||||||
|
VertexAttribute.ColorUnpacked(),
|
||||||
|
VertexAttribute.TexCoords(0)
|
||||||
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
camera.setToOrtho(true)
|
||||||
|
|
||||||
|
quadFull.setVertices(floatArrayOf(
|
||||||
|
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
||||||
|
width.toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
||||||
|
width.toFloat(), height.toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
||||||
|
0f, height.toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
||||||
|
quadFull.setIndices(shortArrayOf(0, 1, 2, 3))
|
||||||
|
|
||||||
|
quadHalf.setVertices(floatArrayOf(
|
||||||
|
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
||||||
|
width.div(2).toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
||||||
|
width.div(2).toFloat(), height.div(2).toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
||||||
|
0f, height.div(2).toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
||||||
|
quadHalf.setIndices(shortArrayOf(0, 1, 2, 3))
|
||||||
|
|
||||||
|
quadQuarter.setVertices(floatArrayOf(
|
||||||
|
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
||||||
|
width.div(4).toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
||||||
|
width.div(4).toFloat(), height.div(4).toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
||||||
|
0f, height.div(4).toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
||||||
|
quadQuarter.setIndices(shortArrayOf(0, 1, 2, 3))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dispose() {
|
||||||
|
full.dispose()
|
||||||
|
half.dispose()
|
||||||
|
quarter.dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val fboDict = HashMap<Long, FrameBufferSet>()
|
||||||
|
|
||||||
|
private lateinit var blurtex0: Texture
|
||||||
|
private lateinit var blurtex1: Texture
|
||||||
|
private lateinit var blurtex2: Texture
|
||||||
|
private lateinit var blurtex3: Texture
|
||||||
|
|
||||||
|
private val shaderKawaseDown = App.loadShaderFromClasspath("shaders/default.vert", "shaders/kawasedown.frag")
|
||||||
|
private val shaderKawaseUp = App.loadShaderFromClasspath("shaders/default.vert", "shaders/kawaseup.frag")
|
||||||
|
|
||||||
|
fun makeBlur(`in`: FrameBuffer, out: FrameBuffer, strength: Float) {
|
||||||
|
assert(`in`.width == out.width && `in`.height == out.height) {
|
||||||
|
"Input and Output dimension mismatch: In(${`in`.width}x${`in`.height}), Out(${out.width}x${out.height})"
|
||||||
|
}
|
||||||
|
|
||||||
|
val fbos = fboDict.getOrPut(`in`.width.toLong().shl(32) or `in`.height.toLong()) {
|
||||||
|
FrameBufferSet(`in`.width, `in`.height)
|
||||||
|
}
|
||||||
|
|
||||||
|
val batch: SpriteBatch? = null // placeholder
|
||||||
|
|
||||||
|
val radius3 = FastMath.pow(strength / 2, 0.5f)//(blurRadius - 3f) / 8f
|
||||||
|
fbos.half.inAction(fbos.camera, batch) {
|
||||||
|
gdxClearAndEnableBlend(0f,0f,0f,0f)
|
||||||
|
|
||||||
|
blurtex0 = `in`.colorBufferTexture
|
||||||
|
blurtex0.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
blurtex0.bind(0)
|
||||||
|
shaderKawaseDown.bind()
|
||||||
|
shaderKawaseDown.setUniformMatrix("u_projTrans", fbos.camera.combined)
|
||||||
|
shaderKawaseDown.setUniformi("u_texture", 0)
|
||||||
|
shaderKawaseDown.setUniformf("halfpixel", radius3 / fbos.half.width, radius3 / fbos.half.height)
|
||||||
|
fbos.quadHalf.render(shaderKawaseDown, GL20.GL_TRIANGLE_FAN)
|
||||||
|
}
|
||||||
|
|
||||||
|
fbos.quarter.inAction(fbos.camera, batch) {
|
||||||
|
gdxClearAndEnableBlend(0f,0f,0f,0f)
|
||||||
|
|
||||||
|
blurtex1 = fbos.half.colorBufferTexture
|
||||||
|
blurtex1.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
blurtex1.bind(0)
|
||||||
|
shaderKawaseDown.bind()
|
||||||
|
shaderKawaseDown.setUniformMatrix("u_projTrans", fbos.camera.combined)
|
||||||
|
shaderKawaseDown.setUniformi("u_texture", 0)
|
||||||
|
shaderKawaseDown.setUniformf("halfpixel", radius3 / fbos.quarter.width, radius3 / fbos.quarter.height)
|
||||||
|
fbos.quadQuarter.render(shaderKawaseDown, GL20.GL_TRIANGLE_FAN)
|
||||||
|
}
|
||||||
|
|
||||||
|
fbos.half.inAction(fbos.camera, batch) {
|
||||||
|
gdxClearAndEnableBlend(0f,0f,0f,0f)
|
||||||
|
|
||||||
|
blurtex2 = fbos.quarter.colorBufferTexture
|
||||||
|
blurtex2.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
blurtex2.bind(0)
|
||||||
|
shaderKawaseUp.bind()
|
||||||
|
shaderKawaseUp.setUniformMatrix("u_projTrans", fbos.camera.combined)
|
||||||
|
shaderKawaseUp.setUniformi("u_texture", 0)
|
||||||
|
shaderKawaseUp.setUniformf("halfpixel", radius3 / fbos.quarter.width, radius3 / fbos.quarter.height)
|
||||||
|
fbos.quadHalf.render(shaderKawaseUp, GL20.GL_TRIANGLE_FAN)
|
||||||
|
}
|
||||||
|
|
||||||
|
out.inAction(fbos.camera, batch) {
|
||||||
|
gdxClearAndEnableBlend(0f,0f,0f,0f)
|
||||||
|
|
||||||
|
blurtex3 = fbos.half.colorBufferTexture
|
||||||
|
blurtex3.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||||
|
blurtex3.bind(0)
|
||||||
|
shaderKawaseUp.bind()
|
||||||
|
shaderKawaseUp.setUniformMatrix("u_projTrans", fbos.camera.combined)
|
||||||
|
shaderKawaseUp.setUniformi("u_texture", 0)
|
||||||
|
shaderKawaseUp.setUniformf("halfpixel", radius3 / fbos.half.width, radius3 / fbos.half.height)
|
||||||
|
fbos.quadFull.render(shaderKawaseUp, GL20.GL_TRIANGLE_FAN)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun dispose() {
|
||||||
|
fboDict.values.forEach { it.dispose() }
|
||||||
|
shaderKawaseUp.dispose()
|
||||||
|
shaderKawaseDown.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -40,12 +40,12 @@ class ConsoleWindow : UICanvas() {
|
|||||||
private var commandHistory = CircularArray<String>(COMMAND_HISTORY_MAX, true)
|
private var commandHistory = CircularArray<String>(COMMAND_HISTORY_MAX, true)
|
||||||
|
|
||||||
private val LINE_HEIGHT = 20
|
private val LINE_HEIGHT = 20
|
||||||
private val MESSAGES_DISPLAY_COUNT = 11
|
private val MESSAGES_DISPLAY_COUNT = 12
|
||||||
|
|
||||||
private val inputToMsgboxGap = 3
|
private val inputToMsgboxGap = 3
|
||||||
|
|
||||||
override var width: Int = App.scr.width
|
override var width: Int = App.scr.width
|
||||||
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1) + inputToMsgboxGap
|
override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1) + inputToMsgboxGap + 4
|
||||||
|
|
||||||
override var openCloseTime = 0f
|
override var openCloseTime = 0f
|
||||||
|
|
||||||
|
|||||||
@@ -44,19 +44,7 @@ object Toolkit : Disposable {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private val shaderKawaseDown = App.loadShaderFromClasspath("shaders/default.vert", "shaders/kawasedown.frag")
|
|
||||||
private val shaderKawaseUp = App.loadShaderFromClasspath("shaders/default.vert", "shaders/kawaseup.frag")
|
|
||||||
private val shaderBoxDown = App.loadShaderFromClasspath("shaders/default.vert", "shaders/boxdown.frag")
|
|
||||||
private val shaderBoxUp = App.loadShaderFromClasspath("shaders/default.vert", "shaders/boxup.frag")
|
|
||||||
|
|
||||||
private lateinit var fboBlur: Float16FrameBuffer
|
private lateinit var fboBlur: Float16FrameBuffer
|
||||||
private lateinit var fboBlurHalf: Float16FrameBuffer
|
|
||||||
private lateinit var fboBlurQuarter: Float16FrameBuffer
|
|
||||||
private lateinit var blurWriteQuad: Mesh
|
|
||||||
private lateinit var blurWriteQuad2: Mesh
|
|
||||||
private lateinit var blurWriteQuad4: Mesh
|
|
||||||
|
|
||||||
// val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36)
|
// val baloonTile = TextureRegionPack("assets/graphics/gui/message_black_tileable.tga", 36, 36)
|
||||||
val shadowTile = TextureRegionPack("assets/graphics/gui/blur_shadow.tga", 32, 32)
|
val shadowTile = TextureRegionPack("assets/graphics/gui/blur_shadow.tga", 32, 32)
|
||||||
@@ -82,19 +70,6 @@ object Toolkit : Disposable {
|
|||||||
// baloonTile.dispose()
|
// baloonTile.dispose()
|
||||||
textureWhiteSquare.dispose()
|
textureWhiteSquare.dispose()
|
||||||
textureWhiteCircle.dispose()
|
textureWhiteCircle.dispose()
|
||||||
|
|
||||||
fboBlur.dispose()
|
|
||||||
fboBlurHalf.dispose()
|
|
||||||
fboBlurQuarter.dispose()
|
|
||||||
|
|
||||||
blurWriteQuad.dispose()
|
|
||||||
blurWriteQuad2.dispose()
|
|
||||||
blurWriteQuad4.dispose()
|
|
||||||
|
|
||||||
shaderKawaseUp.dispose()
|
|
||||||
shaderKawaseDown.dispose()
|
|
||||||
shaderBoxDown.dispose()
|
|
||||||
shaderBoxUp.dispose()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val drawWidth: Int
|
val drawWidth: Int
|
||||||
@@ -201,87 +176,11 @@ object Toolkit : Disposable {
|
|||||||
pixmap.fillRectangle(x + w, y, 1, h)
|
pixmap.fillRectangle(x + w, y, 1, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var blurtex0: Texture
|
fun blurEntireScreen(batch: SpriteBatch, blurRadius0: Float, x: Int, y: Int, w: Int, h: Int) {
|
||||||
private lateinit var blurtex1: Texture
|
|
||||||
private lateinit var blurtex2: Texture
|
|
||||||
private lateinit var blurtex3: Texture
|
|
||||||
|
|
||||||
fun blurEntireScreen(batch: SpriteBatch, camera: OrthographicCamera, blurRadius0: Float, x: Int, y: Int, w: Int, h: Int) {
|
|
||||||
batch.end()
|
batch.end()
|
||||||
|
|
||||||
// val blurRadius = FastMath.pow(blurRadius0, 0.5f)
|
|
||||||
val renderTarget = FrameBufferManager.peek()
|
val renderTarget = FrameBufferManager.peek()
|
||||||
|
BlurMgr.makeBlur(renderTarget, fboBlur, blurRadius0)
|
||||||
//if (blurRadius > 3f) {
|
|
||||||
val radius3 = FastMath.pow(blurRadius0 / 2, 0.5f)//(blurRadius - 3f) / 8f
|
|
||||||
fboBlurHalf.inAction(camera, batch) {
|
|
||||||
blurtex0 = renderTarget.colorBufferTexture
|
|
||||||
blurtex0.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex0.bind(0)
|
|
||||||
shaderKawaseDown.bind()
|
|
||||||
shaderKawaseDown.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseDown.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseDown.setUniformf("halfpixel", radius3 / fboBlurHalf.width, radius3 / fboBlurHalf.height)
|
|
||||||
blurWriteQuad2.render(shaderKawaseDown, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}
|
|
||||||
|
|
||||||
fboBlurQuarter.inAction(camera, batch) {
|
|
||||||
blurtex1 = fboBlurHalf.colorBufferTexture
|
|
||||||
blurtex1.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex1.bind(0)
|
|
||||||
shaderKawaseDown.bind()
|
|
||||||
shaderKawaseDown.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseDown.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseDown.setUniformf("halfpixel", radius3 / fboBlurQuarter.width, radius3 / fboBlurQuarter.height)
|
|
||||||
blurWriteQuad4.render(shaderKawaseDown, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}
|
|
||||||
|
|
||||||
fboBlurHalf.inAction(camera, batch) {
|
|
||||||
blurtex2 = fboBlurQuarter.colorBufferTexture
|
|
||||||
blurtex2.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex2.bind(0)
|
|
||||||
shaderKawaseUp.bind()
|
|
||||||
shaderKawaseUp.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseUp.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseUp.setUniformf("halfpixel", radius3 / fboBlurQuarter.width, radius3 / fboBlurQuarter.height)
|
|
||||||
blurWriteQuad2.render(shaderKawaseUp, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}
|
|
||||||
|
|
||||||
fboBlur.inAction(camera, batch) {
|
|
||||||
blurtex3 = fboBlurHalf.colorBufferTexture
|
|
||||||
blurtex3.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex3.bind(0)
|
|
||||||
shaderKawaseUp.bind()
|
|
||||||
shaderKawaseUp.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseUp.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseUp.setUniformf("halfpixel", radius3 / fboBlurHalf.width, radius3 / fboBlurHalf.height)
|
|
||||||
blurWriteQuad.render(shaderKawaseUp, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
|
|
||||||
/*fboBlurHalf.inAction(camera, batch) {
|
|
||||||
blurtex2 = renderTarget.colorBufferTexture
|
|
||||||
blurtex2.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex2.bind(0)
|
|
||||||
shaderKawaseDown.bind()
|
|
||||||
shaderKawaseDown.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseDown.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseDown.setUniformf("halfpixel", blurRadius / fboBlurHalf.width, blurRadius / fboBlurHalf.height)
|
|
||||||
blurWriteQuad2.render(shaderKawaseDown, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}
|
|
||||||
|
|
||||||
fboBlur.inAction(camera, batch) {
|
|
||||||
blurtex3 = fboBlurHalf.colorBufferTexture
|
|
||||||
blurtex3.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
|
||||||
blurtex3.bind(0)
|
|
||||||
shaderKawaseUp.bind()
|
|
||||||
shaderKawaseUp.setUniformMatrix("u_projTrans", camera.combined)
|
|
||||||
shaderKawaseUp.setUniformi("u_texture", 0)
|
|
||||||
shaderKawaseUp.setUniformf("halfpixel", blurRadius / fboBlurHalf.width, blurRadius / fboBlurHalf.height)
|
|
||||||
blurWriteQuad.render(shaderKawaseUp, GL20.GL_TRIANGLE_FAN)
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0) // so that batch that comes next will bind any tex to it
|
||||||
|
|
||||||
@@ -344,33 +243,9 @@ object Toolkit : Disposable {
|
|||||||
init = true
|
init = true
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
blurWriteQuad.dispose()
|
|
||||||
blurWriteQuad2.dispose()
|
|
||||||
blurWriteQuad4.dispose()
|
|
||||||
fboBlur.dispose()
|
fboBlur.dispose()
|
||||||
fboBlurHalf.dispose()
|
|
||||||
fboBlurQuarter.dispose()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blurWriteQuad = Mesh(
|
|
||||||
true, 4, 4,
|
|
||||||
VertexAttribute.Position(),
|
|
||||||
VertexAttribute.ColorUnpacked(),
|
|
||||||
VertexAttribute.TexCoords(0)
|
|
||||||
)
|
|
||||||
blurWriteQuad2 = Mesh(
|
|
||||||
true, 4, 4,
|
|
||||||
VertexAttribute.Position(),
|
|
||||||
VertexAttribute.ColorUnpacked(),
|
|
||||||
VertexAttribute.TexCoords(0)
|
|
||||||
)
|
|
||||||
blurWriteQuad4 = Mesh(
|
|
||||||
true, 4, 4,
|
|
||||||
VertexAttribute.Position(),
|
|
||||||
VertexAttribute.ColorUnpacked(),
|
|
||||||
VertexAttribute.TexCoords(0)
|
|
||||||
)
|
|
||||||
|
|
||||||
val fw = App.scr.width//MathUtils.nextPowerOfTwo(App.scr.width)
|
val fw = App.scr.width//MathUtils.nextPowerOfTwo(App.scr.width)
|
||||||
val fh = App.scr.height//MathUtils.nextPowerOfTwo(App.scr.height)
|
val fh = App.scr.height//MathUtils.nextPowerOfTwo(App.scr.height)
|
||||||
|
|
||||||
@@ -379,36 +254,5 @@ object Toolkit : Disposable {
|
|||||||
fh,
|
fh,
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
fboBlurHalf = Float16FrameBuffer(
|
|
||||||
fw / 2,
|
|
||||||
fh / 2,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
fboBlurQuarter = Float16FrameBuffer(
|
|
||||||
fw / 4,
|
|
||||||
fh / 4,
|
|
||||||
false
|
|
||||||
)
|
|
||||||
|
|
||||||
blurWriteQuad.setVertices(floatArrayOf(
|
|
||||||
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
|
||||||
fw.toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
|
||||||
fw.toFloat(), fh.toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
|
||||||
0f, fh.toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
|
||||||
blurWriteQuad.setIndices(shortArrayOf(0, 1, 2, 3))
|
|
||||||
|
|
||||||
blurWriteQuad2.setVertices(floatArrayOf(
|
|
||||||
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
|
||||||
fw.div(2).toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
|
||||||
fw.div(2).toFloat(), fh.div(2).toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
|
||||||
0f, fh.div(2).toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
|
||||||
blurWriteQuad2.setIndices(shortArrayOf(0, 1, 2, 3))
|
|
||||||
|
|
||||||
blurWriteQuad4.setVertices(floatArrayOf(
|
|
||||||
0f,0f,0f, 1f,1f,1f,1f, 0f,1f,
|
|
||||||
fw.div(4).toFloat(),0f,0f, 1f,1f,1f,1f, 1f,1f,
|
|
||||||
fw.div(4).toFloat(), fh.div(4).toFloat(),0f, 1f,1f,1f,1f, 1f,0f,
|
|
||||||
0f, fh.div(4).toFloat(),0f, 1f,1f,1f,1f, 0f,0f))
|
|
||||||
blurWriteQuad4.setIndices(shortArrayOf(0, 1, 2, 3))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +136,7 @@ abstract class UICanvas(
|
|||||||
|
|
||||||
/** A function that is run ONCE when the UI is requested to be opened; will work identical to [endOpening] if [openCloseTime] is zero */
|
/** A function that is run ONCE when the UI is requested to be opened; will work identical to [endOpening] if [openCloseTime] is zero */
|
||||||
open fun show() {
|
open fun show() {
|
||||||
|
clearTooltip()
|
||||||
openingClickLatched = true
|
openingClickLatched = true
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
handler.subUIs.forEach { it.show() }
|
handler.subUIs.forEach { it.show() }
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ internal object BlocksDrawer {
|
|||||||
fillInTileBuffer(TERRAIN) // regular tiles
|
fillInTileBuffer(TERRAIN) // regular tiles
|
||||||
fillInTileBuffer(ORES)
|
fillInTileBuffer(ORES)
|
||||||
fillInTileBuffer(FLUID)
|
fillInTileBuffer(FLUID)
|
||||||
fillInTileBuffer(OCCLUSION)
|
// fillInTileBuffer(OCCLUSION)
|
||||||
prepareDrawBuffers()
|
prepareDrawBuffers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -289,7 +289,7 @@ internal object BlocksDrawer {
|
|||||||
renderUsingBuffer(WALL, projectionMatrix, drawGlow, drawEmissive)
|
renderUsingBuffer(WALL, projectionMatrix, drawGlow, drawEmissive)
|
||||||
|
|
||||||
gdxBlendMul()
|
gdxBlendMul()
|
||||||
renderUsingBuffer(OCCLUSION, projectionMatrix, false, drawEmissive)
|
// renderUsingBuffer(OCCLUSION, projectionMatrix, false, drawEmissive)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ class CreateTileAtlas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// test print
|
// test print
|
||||||
PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas.tga"), atlas, false)
|
// PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas.tga"), atlas, false)
|
||||||
// PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasGlow.tga"), atlasGlow, false)
|
// PixmapIO2.writeTGA(Gdx.files.absolute("${AppLoader.defaultDir}/atlasGlow.tga"), atlasGlow, false)
|
||||||
|
|
||||||
// PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas_0.tga"), atlasPrevernal, false)
|
// PixmapIO2.writeTGA(Gdx.files.absolute("${App.defaultDir}/atlas_0.tga"), atlasPrevernal, false)
|
||||||
|
|||||||
20
src/shaders/shadowdeep.frag
Normal file
20
src/shaders/shadowdeep.frag
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
in vec4 v_color;
|
||||||
|
in vec4 v_generic;
|
||||||
|
in vec2 v_texCoords;
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
uniform sampler2D u_wall;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
vec4 mult = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 backcol = texture(u_wall, v_texCoords);
|
||||||
|
vec4 incol = texture(u_texture, v_texCoords);
|
||||||
|
vec4 outcol = vec4(incol.rgb, backcol.a * pow(incol.a, 1.4142));
|
||||||
|
fragColor = mult * outcol;
|
||||||
|
}
|
||||||
20
src/shaders/shadowshallow.frag
Normal file
20
src/shaders/shadowshallow.frag
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
in vec4 v_color;
|
||||||
|
in vec4 v_generic;
|
||||||
|
in vec2 v_texCoords;
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
uniform sampler2D u_wall;
|
||||||
|
out vec4 fragColor;
|
||||||
|
|
||||||
|
vec4 mult = vec4(0.0, 0.0, 0.0, 1.4142);
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vec4 backcol = texture(u_wall, v_texCoords);
|
||||||
|
vec4 incol = texture(u_texture, v_texCoords);
|
||||||
|
vec4 outcol = vec4(incol.rgb, backcol.a * pow(incol.a, 2.0));
|
||||||
|
fragColor = mult * outcol;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user