mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 18:14:06 +09:00
rock vein
This commit is contained in:
@@ -133,6 +133,7 @@ class Oregen(world: GameWorld, private val caveAttenuateBiasScaledCache: ModuleC
|
|||||||
|
|
||||||
it.setSource(orePerturb)
|
it.setSource(orePerturb)
|
||||||
it.setScaleX(1.0 / xs)
|
it.setScaleX(1.0 / xs)
|
||||||
|
it.setScaleZ(1.0 / xs)
|
||||||
it.setScaleY(1.0 / ys)
|
it.setScaleY(1.0 / ys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -172,6 +172,8 @@ data class TerragenParams(
|
|||||||
val caveBlockageFractalFreq: Double = 8.88,
|
val caveBlockageFractalFreq: Double = 8.88,
|
||||||
val caveBlockageSelectThre: Double = 1.40, // adjust cave cloing-up strength. Larger = more closing
|
val caveBlockageSelectThre: Double = 1.40, // adjust cave cloing-up strength. Larger = more closing
|
||||||
|
|
||||||
|
val rockBandCutoffFreq: Double = 4.0,
|
||||||
|
|
||||||
// val oreCopperFreq: Double = 0.024, // adjust the "density" of the ore veins
|
// val oreCopperFreq: Double = 0.024, // adjust the "density" of the ore veins
|
||||||
// val oreCopperPower: Double = 0.01, // super-low value almost negates the depth element
|
// val oreCopperPower: Double = 0.01, // super-low value almost negates the depth element
|
||||||
// val oreCopperScale: Double = 0.505,
|
// val oreCopperScale: Double = 0.505,
|
||||||
@@ -185,4 +187,5 @@ data class TerragenParams(
|
|||||||
// 0.1 - 0.5
|
// 0.1 - 0.5
|
||||||
// ...
|
// ...
|
||||||
// 0.8 - 0.42
|
// 0.8 - 0.42
|
||||||
)
|
) {
|
||||||
|
}
|
||||||
@@ -685,11 +685,11 @@ internal object TerragenTest : NoiseMaker {
|
|||||||
Joise(generateOreVeinModule(caveAttenuateBiasScaledCache, seed shake "ores@basegame:7", 0.013, 0.300, 0.476, 1.0)),
|
Joise(generateOreVeinModule(caveAttenuateBiasScaledCache, seed shake "ores@basegame:7", 0.013, 0.300, 0.476, 1.0)),
|
||||||
Joise(generateOreVeinModule(caveAttenuateBiasScaledCache, seed shake "ores@basegame:8", 0.017, 0.020, 0.511, 1.0)),
|
Joise(generateOreVeinModule(caveAttenuateBiasScaledCache, seed shake "ores@basegame:8", 0.017, 0.020, 0.511, 1.0)),
|
||||||
|
|
||||||
Joise(generateRockLayer(groundScalingCached, seed shake 10, 2.6, 2.62)),
|
Joise(generateRockLayer(groundScalingCached, seed shake 10, params, 0.03, 2.6,)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateRockLayer(ground: ModuleCache, seed: Long, rangeStart: Double, rangeEnd: Double): Module {
|
private fun generateRockLayer(ground: ModuleCache, seed: Long, params: TerragenParams, thickness: Double, rangeStart: Double): Module {
|
||||||
val thresholdLow = ModuleSelect().also {
|
val thresholdLow = ModuleSelect().also {
|
||||||
it.setLowSource(0.0)
|
it.setLowSource(0.0)
|
||||||
it.setHighSource(1.0)
|
it.setHighSource(1.0)
|
||||||
@@ -702,20 +702,43 @@ internal object TerragenTest : NoiseMaker {
|
|||||||
it.setLowSource(1.0)
|
it.setLowSource(1.0)
|
||||||
it.setHighSource(0.0)
|
it.setHighSource(0.0)
|
||||||
it.setControlSource(ground)
|
it.setControlSource(ground)
|
||||||
it.setThreshold(rangeEnd)
|
it.setThreshold(rangeStart + thickness)
|
||||||
it.setFalloff(0.0)
|
it.setFalloff(0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
val band = ModuleCombiner().also {
|
|
||||||
|
val occlusion = ModuleFractal().also {
|
||||||
|
it.setType(ModuleFractal.FractalType.RIDGEMULTI)
|
||||||
|
it.setAllSourceBasisTypes(ModuleBasisFunction.BasisType.SIMPLEX)
|
||||||
|
it.setAllSourceInterpolationTypes(ModuleBasisFunction.InterpolationType.QUINTIC)
|
||||||
|
it.setNumOctaves(2)
|
||||||
|
it.setFrequency(params.rockBandCutoffFreq / params.featureSize) // adjust the "density" of the veins
|
||||||
|
it.seed = seed
|
||||||
|
}
|
||||||
|
|
||||||
|
val occlusionScale = ModuleScaleDomain().also {
|
||||||
|
it.setScaleX(0.5)
|
||||||
|
it.setScaleZ(0.5)
|
||||||
|
it.setSource(occlusion)
|
||||||
|
}
|
||||||
|
|
||||||
|
val occlusionBinary = ModuleSelect().also {
|
||||||
|
it.setLowSource(0.0)
|
||||||
|
it.setHighSource(1.0)
|
||||||
|
it.setControlSource(occlusionScale)
|
||||||
|
it.setThreshold(1.1)
|
||||||
|
it.setFalloff(0.0)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
val occBand = ModuleCombiner().also {
|
||||||
it.setSource(0, thresholdLow)
|
it.setSource(0, thresholdLow)
|
||||||
it.setSource(1, thresholdHigh)
|
it.setSource(1, thresholdHigh)
|
||||||
|
it.setSource(2, occlusionBinary)
|
||||||
it.setType(ModuleCombiner.CombinerType.MULT)
|
it.setType(ModuleCombiner.CombinerType.MULT)
|
||||||
}
|
}
|
||||||
|
|
||||||
return band
|
return occBand
|
||||||
|
|
||||||
|
|
||||||
// TODO combine another noise generator to cut off the otherwise continuous line of stone layer
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun applyPowMult(joiseModule: Module, pow: Double, mult: Double): Module {
|
private fun applyPowMult(joiseModule: Module, pow: Double, mult: Double): Module {
|
||||||
@@ -781,6 +804,7 @@ internal object TerragenTest : NoiseMaker {
|
|||||||
|
|
||||||
it.setSource(orePerturb)
|
it.setSource(orePerturb)
|
||||||
it.setScaleX(1.0 / xs)
|
it.setScaleX(1.0 / xs)
|
||||||
|
it.setScaleZ(1.0 / xs)
|
||||||
it.setScaleY(1.0 / ys)
|
it.setScaleY(1.0 / ys)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user