fix: wetting tile using wrong tile

This commit is contained in:
minjaesong
2024-08-31 22:24:31 +09:00
parent 84f0353f09
commit 54d1218b4a
3 changed files with 31 additions and 12 deletions

View File

@@ -287,7 +287,7 @@ data class TerragenParamsAlpha2(
override val mountainDisturbance: Double = 0.7, // greater = more distortion, overhangs
override val caveShapeFreq: Double = 4.0, //adjust the "density" of the caves
override val caveAttenuateScale: Double = 0.98, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateScale: Double = 0.95, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateBias: Double = 0.93, // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
override val caveSelectThre: Double = 0.918, // also adjust this if you've touched the bias value. Number can be greater than 1.0
override val caveBlockageFractalFreq: Double = 8.88,

View File

@@ -33,8 +33,9 @@ import kotlin.random.Random
import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen.YHEIGHT_DIVISOR
import net.torvald.terrarum.modulebasegame.worldgenerator.Worldgen.YHEIGHT_MAGIC
import java.io.PrintStream
import java.util.Calendar
const val NOISEBOX_WIDTH = 1200
const val NOISEBOX_WIDTH = 1600
const val NOISEBOX_HEIGHT = 2400
const val TWO_PI = Math.PI * 2
@@ -53,7 +54,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
private lateinit var tempTex: Texture
private val RNG = HQRNG()
private var seed = 10000L
private var seed = 373231L // old default seed: 10000L
private var initialGenDone = false
@@ -80,6 +81,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
}
private var generationTime = 0f
private var today = ""
private val NM_TERR = TerragenTest to TerragenParamsAlpha2()
private val NM_BIOME = BiomeMaker to BiomegenParams()
@@ -110,11 +112,17 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
// draw timer
batch.inUse {
if (worldgenDone) {
font.draw(batch, "Generation time: ${generationTime} seconds", 8f, 8f)
font.draw(batch, "Generation time: ${generationTime} seconds Time: $today", 8f, 8f)
}
else {
font.draw(batch, "Generating...", 8f, 8f)
}
font.draw(batch, "Seed: $seed", 8f, 8f + 1*20)
font.draw(batch, "caveAttenuateScale=${NM_TERR.second.caveAttenuateScale}", 8f, 8f + 2*20)
font.draw(batch, "caveAttenuateBias=${NM_TERR.second.caveAttenuateBias}", 8f, 8f + 3*20)
font.draw(batch, "caveSelectThre=${NM_TERR.second.caveSelectThre}", 8f, 8f + 4*20)
}
}
@@ -223,8 +231,21 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
worldgenDone = true
val time = System.nanoTime() - generationStartTime
val timeNow = System.nanoTime()
val time = timeNow - generationStartTime
generationTime = time / 1000000000f
Calendar.getInstance().apply {
today =
"${get(Calendar.YEAR)}-" +
"${get(Calendar.MONTH).plus(1).toString().padStart(2,'0')}-" +
"${get(Calendar.DAY_OF_MONTH).toString().padStart(2,'0')}T" +
"${get(Calendar.HOUR_OF_DAY).toString().padStart(2,'0')}:" +
"${get(Calendar.MINUTE).toString().padStart(2,'0')}:" +
"${get(Calendar.SECOND).toString().padStart(2,'0')}"
}
callback()
}.start()

View File

@@ -462,7 +462,7 @@ internal object BlocksDrawer {
if (number == 65535 || fill < 1f/30f) 0
else number
}
OCCLUSION -> 0
OCCLUSION -> occlusionRenderTag.tileNumber
else -> throw IllegalArgumentException()
}
@@ -587,8 +587,6 @@ internal object BlocksDrawer {
0
}
val tileNumberBase = renderTag.tileNumber
val breakage = if (mode == TERRAIN || mode == ORES)
world.getTerrainDamage(x, y)
else if (mode == WALL)
@@ -647,7 +645,7 @@ internal object BlocksDrawer {
}.fold(0) { acc, it -> acc or it }
}
else null
val subtiles = getSubtileIndexOf(tileNumberBase, nearbyTilesInfo, hash, subtileSwizzlers, variantOps, nearbyGrasses)
val subtiles = getSubtileIndexOf(rawTileNum, nearbyTilesInfo, hash, subtileSwizzlers, variantOps, nearbyGrasses)
/*TL*/writeToBufferSubtile(mode, bufferBaseX * 2 + 0, bufferBaseY * 2 + 0, subtiles[0].x, subtiles[0].y, breakingStage, subtileSwizzlers[0])
/*TR*/writeToBufferSubtile(mode, bufferBaseX * 2 + 1, bufferBaseY * 2 + 0, subtiles[1].x, subtiles[1].y, breakingStage, subtileSwizzlers[1])
@@ -661,12 +659,12 @@ internal object BlocksDrawer {
0
// special case: fluids
else if (mode == FLUID)
tileNumberBase + nearbyTilesInfo
rawTileNum + nearbyTilesInfo
// special case: ores
else if (mode == ORES)
tileNumberBase + world.layerOres.unsafeGetTile1(wx, wy).second
rawTileNum + world.layerOres.unsafeGetTile1(wx, wy).second
// rest of the cases: terrain and walls
else tileNumberBase + when (renderTag.maskType) {
else rawTileNum + when (renderTag.maskType) {
CreateTileAtlas.RenderTag.MASK_NA -> 0
CreateTileAtlas.RenderTag.MASK_16 -> connectLut16[nearbyTilesInfo]
CreateTileAtlas.RenderTag.MASK_47 -> connectLut47[nearbyTilesInfo]