mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 03:24:06 +09:00
update gitignore, new worldgen wip
This commit is contained in:
@@ -19,6 +19,9 @@ import net.torvald.terrarum.concurrent.ThreadParallel
|
||||
import net.torvald.terrarum.concurrent.mapToThreadPoolDirectly
|
||||
import net.torvald.terrarum.gameworld.fmod
|
||||
import net.torvald.terrarum.inUse
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.BiomegenParams
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.TerragenParams
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.shake
|
||||
import kotlin.math.cos
|
||||
import kotlin.math.sin
|
||||
|
||||
@@ -115,7 +118,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
|
||||
private val NOISE_MAKER = AccidentalCave
|
||||
|
||||
private fun getNoiseGenerator(SEED: Long): List<Joise> {
|
||||
return NOISE_MAKER.getGenerator(SEED)
|
||||
return NOISE_MAKER.getGenerator(SEED, TerragenParams())
|
||||
}
|
||||
|
||||
val colourNull = Color(0x1b3281ff)
|
||||
@@ -167,7 +170,7 @@ fun main(args: Array<String>) {
|
||||
|
||||
interface NoiseMaker {
|
||||
fun draw(x: Int, y: Int, noiseValue: List<Double>, outTex: Pixmap)
|
||||
fun getGenerator(seed: Long): List<Joise>
|
||||
fun getGenerator(seed: Long, params: Any): List<Joise>
|
||||
}
|
||||
|
||||
object BiomeMaker : NoiseMaker {
|
||||
@@ -181,7 +184,8 @@ object BiomeMaker : NoiseMaker {
|
||||
outTex.drawPixel(x, y)
|
||||
}
|
||||
|
||||
override fun getGenerator(seed: Long): List<Joise> {
|
||||
override fun getGenerator(seed: Long, params: Any): List<Joise> {
|
||||
val params = params as BiomegenParams
|
||||
//val biome = ModuleBasisFunction()
|
||||
//biome.setType(ModuleBasisFunction.BasisType.SIMPLEX)
|
||||
|
||||
@@ -199,9 +203,9 @@ object BiomeMaker : NoiseMaker {
|
||||
|
||||
val scale = ModuleScaleDomain()
|
||||
scale.setSource(autocorrect)
|
||||
scale.setScaleX(1.0 / 80.0) // adjust this value to change features size
|
||||
scale.setScaleY(1.0 / 80.0)
|
||||
scale.setScaleZ(1.0 / 80.0)
|
||||
scale.setScaleX(1.0 / params.featureSize) // adjust this value to change features size
|
||||
scale.setScaleY(1.0 / params.featureSize)
|
||||
scale.setScaleZ(1.0 / params.featureSize)
|
||||
|
||||
val last = scale
|
||||
|
||||
@@ -269,7 +273,9 @@ object AccidentalCave : NoiseMaker {
|
||||
outTex.drawPixel(x, y)
|
||||
}
|
||||
|
||||
override fun getGenerator(seed: Long): List<Joise> {
|
||||
override fun getGenerator(seed: Long, params: Any): List<Joise> {
|
||||
val params = params as TerragenParams
|
||||
|
||||
val lowlandMagic: Long = 0x41A21A114DBE56 // Maria Lindberg
|
||||
val highlandMagic: Long = 0x0114E091 // Olive Oyl
|
||||
val mountainMagic: Long = 0x115AA4DE2504 // Lisa Anderson
|
||||
@@ -300,7 +306,7 @@ object AccidentalCave : NoiseMaker {
|
||||
|
||||
val lowlandScale = ModuleScaleOffset()
|
||||
lowlandScale.setScale(0.125)
|
||||
lowlandScale.setOffset(-0.65) // TODO linearly alters the height
|
||||
lowlandScale.setOffset(params.lowlandScaleOffset) // TODO linearly alters the height
|
||||
|
||||
val lowlandYScale = ModuleScaleDomain()
|
||||
lowlandYScale.setSource(lowlandScale)
|
||||
@@ -328,7 +334,7 @@ object AccidentalCave : NoiseMaker {
|
||||
val highlandScale = ModuleScaleOffset()
|
||||
highlandScale.setSource(highlandAutocorrect)
|
||||
highlandScale.setScale(0.25)
|
||||
highlandScale.setOffset(-0.2) // TODO linearly alters the height
|
||||
highlandScale.setOffset(params.highlandScaleOffset) // TODO linearly alters the height
|
||||
|
||||
val highlandYScale = ModuleScaleDomain()
|
||||
highlandYScale.setSource(highlandScale)
|
||||
@@ -355,11 +361,11 @@ object AccidentalCave : NoiseMaker {
|
||||
val mountainScale = ModuleScaleOffset()
|
||||
mountainScale.setSource(mountainAutocorrect)
|
||||
mountainScale.setScale(0.45)
|
||||
mountainScale.setOffset(-0.1) // TODO linearly alters the height
|
||||
mountainScale.setOffset(params.mountainScaleOffset) // TODO linearly alters the height
|
||||
|
||||
val mountainYScale = ModuleScaleDomain()
|
||||
mountainYScale.setSource(mountainScale)
|
||||
mountainYScale.setScaleY(0.7) // greater = more distortion, overhangs
|
||||
mountainYScale.setScaleY(params.mountainDisturbance) // greater = more distortion, overhangs
|
||||
|
||||
val mountainTerrain = ModuleTranslateDomain()
|
||||
mountainTerrain.setSource(groundGradient)
|
||||
@@ -423,12 +429,12 @@ object AccidentalCave : NoiseMaker {
|
||||
caveShape.setAllSourceBasisTypes(ModuleBasisFunction.BasisType.GRADIENT)
|
||||
caveShape.setAllSourceInterpolationTypes(ModuleBasisFunction.InterpolationType.QUINTIC)
|
||||
caveShape.setNumOctaves(1)
|
||||
caveShape.setFrequency(7.4) // TODO adjust the "density" of the caves
|
||||
caveShape.setFrequency(params.caveShapeFreq) // TODO adjust the "density" of the caves
|
||||
caveShape.seed = seed shake caveMagic
|
||||
|
||||
val caveAttenuateBias = ModuleBias()
|
||||
caveAttenuateBias.setSource(highlandLowlandSelectCache)
|
||||
caveAttenuateBias.setBias(0.90) // TODO (0.5+) adjust the "concentration" of the cave gen. Lower = larger voids
|
||||
caveAttenuateBias.setBias(params.caveAttenuateBias) // TODO (0.5+) adjust the "concentration" of the cave gen. Lower = larger voids
|
||||
|
||||
val caveShapeAttenuate = ModuleCombiner()
|
||||
caveShapeAttenuate.setType(ModuleCombiner.CombinerType.MULT)
|
||||
@@ -456,7 +462,7 @@ object AccidentalCave : NoiseMaker {
|
||||
caveSelect.setLowSource(1.0)
|
||||
caveSelect.setHighSource(0.0)
|
||||
caveSelect.setControlSource(cavePerturb)
|
||||
caveSelect.setThreshold(0.89) // TODO also adjust this if you've touched the bias value. Number can be greater than 1.0
|
||||
caveSelect.setThreshold(params.caveSelectThre) // TODO also adjust this if you've touched the bias value. Number can be greater than 1.0
|
||||
caveSelect.setFalloff(0.0)
|
||||
|
||||
val caveBlockageFractal = ModuleFractal()
|
||||
@@ -464,7 +470,7 @@ object AccidentalCave : NoiseMaker {
|
||||
caveBlockageFractal.setAllSourceBasisTypes(ModuleBasisFunction.BasisType.GRADIENT)
|
||||
caveBlockageFractal.setAllSourceInterpolationTypes(ModuleBasisFunction.InterpolationType.QUINTIC)
|
||||
caveBlockageFractal.setNumOctaves(2)
|
||||
caveBlockageFractal.setFrequency(8.88) // TODO same as caveShape frequency?
|
||||
caveBlockageFractal.setFrequency(params.caveBlockageFractalFreq) // TODO same as caveShape frequency?
|
||||
caveBlockageFractal.seed = seed shake caveBlockageMagic
|
||||
|
||||
// will only close-up deeper caves. Shallow caves will be less likely to be closed up
|
||||
@@ -477,7 +483,7 @@ object AccidentalCave : NoiseMaker {
|
||||
caveBlockageSelect.setLowSource(0.0)
|
||||
caveBlockageSelect.setHighSource(1.0)
|
||||
caveBlockageSelect.setControlSource(caveBlockageAttenuate)
|
||||
caveBlockageSelect.setThreshold(1.40) // TODO adjust cave cloing-up strength. Larger = more closing
|
||||
caveBlockageSelect.setThreshold(params.caveBlockageSelectThre) // TODO adjust cave cloing-up strength. Larger = more closing
|
||||
caveBlockageSelect.setFalloff(0.0)
|
||||
|
||||
// note: gradient-multiply DOESN'T generate "naturally cramped" cave entrance
|
||||
@@ -502,9 +508,9 @@ object AccidentalCave : NoiseMaker {
|
||||
groundClamp.setSource(highlandLowlandSelectCache)
|
||||
|
||||
val groundScaling = ModuleScaleDomain()
|
||||
groundScaling.setScaleX(1.0 / 333.0) // adjust this value to change features size
|
||||
groundScaling.setScaleY(1.0 / 333.0)
|
||||
groundScaling.setScaleZ(1.0 / 333.0)
|
||||
groundScaling.setScaleX(1.0 / params.featureSize) // adjust this value to change features size
|
||||
groundScaling.setScaleY(1.0 / params.featureSize)
|
||||
groundScaling.setScaleZ(1.0 / params.featureSize)
|
||||
groundScaling.setSource(groundClamp)
|
||||
|
||||
|
||||
@@ -513,9 +519,9 @@ object AccidentalCave : NoiseMaker {
|
||||
caveClamp.setSource(caveInMix)
|
||||
|
||||
val caveScaling = ModuleScaleDomain()
|
||||
caveScaling.setScaleX(1.0 / 333.0) // adjust this value to change features size
|
||||
caveScaling.setScaleY(1.0 / 333.0)
|
||||
caveScaling.setScaleZ(1.0 / 333.0)
|
||||
caveScaling.setScaleX(1.0 / params.featureSize) // adjust this value to change features size
|
||||
caveScaling.setScaleY(1.0 / params.featureSize)
|
||||
caveScaling.setScaleZ(1.0 / params.featureSize)
|
||||
caveScaling.setSource(caveClamp)
|
||||
|
||||
//return Joise(caveInMix)
|
||||
@@ -528,7 +534,7 @@ object AccidentalCave : NoiseMaker {
|
||||
|
||||
|
||||
|
||||
infix fun Long.shake(other: Long): Long {
|
||||
/*infix fun Long.shake(other: Long): Long {
|
||||
var s0 = this
|
||||
var s1 = other
|
||||
|
||||
@@ -537,4 +543,4 @@ infix fun Long.shake(other: Long): Long {
|
||||
s1 = s1 shl 36 or s1.ushr(28)
|
||||
|
||||
return s0 + s1
|
||||
}
|
||||
}*/
|
||||
Reference in New Issue
Block a user