rudimentary fluid rendering so that I can work on it

This commit is contained in:
minjaesong
2024-07-15 03:33:31 +09:00
parent 5f1b860555
commit 6399f609a9
7 changed files with 41 additions and 30 deletions

View File

@@ -46,8 +46,7 @@ object WorldSimulator {
const val FLUID_MAX_MASS = 1f // The normal, un-pressurized mass of a full water cell
const val FLUID_MAX_COMP = 0.02f // How much excess water a cell can store, compared to the cell above it. A tile of fluid can contain more than MaxMass water.
const val FLUID_MIN_MASS = net.torvald.terrarum.gameworld.FLUID_MIN_MASS //Ignore cells that are almost dry (smaller than epsilon of float16)
const val WIRE_MIN_FLOW = 0.0001f
const val minFlow = 0.01f
const val minFlow = 1f / 512f
const val maxSpeed = 1f // max units of water moved out of one block to another, per timestamp
// END OF FLUID-RELATED STUFFS

View File

@@ -0,0 +1,32 @@
package net.torvald.terrarum.modulebasegame.console
import com.badlogic.gdx.Gdx
import net.torvald.gdx.graphics.PixmapIO2
import net.torvald.terrarum.App
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import java.io.File
/**
* Created by minjaesong on 2024-07-15.
*/
class ExportAtlas : ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size == 2) {
val dir = App.defaultDir + "/Exports/"
val dirAsFile = File(dir)
if (!dirAsFile.exists()) {
dirAsFile.mkdir()
}
PixmapIO2.writeTGA(Gdx.files.absolute("$dir${args[1]}.tga"), App.tileMaker.atlas, false)
}
}
override fun printUsage() {
Echo("Usage: exportatlas <name>")
Echo("Exports current tile atlas into an image.")
Echo("The image can be found at %appdata%/terrarum/Exports")
}
}

View File

@@ -115,7 +115,7 @@ internal object ExportMap : ConsoleCommand {
override fun printUsage() {
Echo("Usage: export <name>")
Echo("Exports current map into echo image.")
Echo("Exports current map into an image.")
Echo("The image can be found at %appdata%/terrarum/Exports")
}
}

View File

@@ -30,7 +30,6 @@ class ItemBottomlessWaterBucket(originalID: ItemID) : GameItem(originalID) {
override fun startPrimaryUse(actor: ActorWithBody, delta: Float): Long {
val mx = Terrarum.mouseTileX; val my =Terrarum.mouseTileY
INGAME.world.setFluid(mx, my, Fluid.WATER, 1f)
printdbg(this, "Pouring water at ($mx, $my)")
return 0L
}
}