more clouds

This commit is contained in:
minjaesong
2023-08-22 20:06:22 +09:00
parent 52938a4b60
commit a9dbea3d16
4 changed files with 16 additions and 15 deletions

View File

@@ -5,7 +5,7 @@
"cloudChance": 33,
"cloudGamma": [0.48, 1.8],
"cloudGammaVariance": [0.1, 0.1],
"cloudDriftSpeed": 0.08,
"cloudDriftSpeed": 0.16,
"clouds": {
"cumulonimbus": {
"filename": "cloud_large.png", "tw": 2048, "th": 1024, "probability": 0.25,

View File

@@ -255,7 +255,9 @@ object IngameRenderer : Disposable {
gdxClearAndEnableBlend(0f, 0f, 0f, 0f)
// draw sky
WeatherMixer.render(camera, batch, world)
measureDebugTime("WeatherMixer.render") {
WeatherMixer.render(camera, batch, world)
}
// normal behaviour

View File

@@ -292,16 +292,16 @@ class BasicDebugInfoWindow : UICanvas() {
if (ingame != null) {
App.fontSmallNumbers.draw(batch, "${ccY}Actors total $ccG${ingame!!.actorContainerActive.size + ingame!!.actorContainerInactive.size}",
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 2f)
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 2f)
App.fontSmallNumbers.draw(batch, "${ccY}Active $ccG${ingame!!.actorContainerActive.size}",
(TinyAlphNum.W * 2 + 17 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
TinyAlphNum.W * 2f + (17 * 8), App.scr.height - TinyAlphNum.H * 2f)
App.fontSmallNumbers.draw(batch, "${ccY}Dormant $ccG${ingame!!.actorContainerInactive.size}",
(TinyAlphNum.W * 2 + 28 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
TinyAlphNum.W * 2f + (28 * 8), App.scr.height - TinyAlphNum.H * 2f)
if (ingame is TerrarumIngame) {
App.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}",
(TinyAlphNum.W * 2 + 41 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
App.fontSmallNumbers.draw(batch, "${ccM}Clouds $ccG${WeatherMixer.cloudsSpawned}",
(TinyAlphNum.W * 2 + 53 * 8).toFloat(), App.scr.height - TinyAlphNum.H * 2f)
App.fontSmallNumbers.draw(batch, "${ccM}Particles $ccG${(ingame as TerrarumIngame).particlesActive}$ccY/$ccG${(ingame as TerrarumIngame).PARTICLES_MAX}",
TinyAlphNum.W * 2f, App.scr.height - TinyAlphNum.H * 4f)
App.fontSmallNumbers.draw(batch, "${ccM}Clouds $ccG${WeatherMixer.cloudsSpawned}$ccY/$ccG${WeatherMixer.cloudSpawnMax}",
TinyAlphNum.W * 2f + (18 * 8), App.scr.height - TinyAlphNum.H * 4f)
}
}

View File

@@ -95,8 +95,8 @@ internal object WeatherMixer : RNGConsumer {
private val clouds = SortedArrayList<WeatherObjectCloud>()
var cloudsSpawned = 0; private set
private var cloudDriftVector = Vector3(-1f, 0f, 0.1f) // this is a direction vector
private val cloudSpawnMax: Int
get() = App.getConfigInt("maxparticles") * 2
val cloudSpawnMax: Int
get() = 256 shl (App.getConfigInt("maxparticles") / 256)
override fun loadFromSave(s0: Long, s1: Long) {
super.loadFromSave(s0, s1)
@@ -220,7 +220,7 @@ internal object WeatherMixer : RNGConsumer {
val cloudChanceEveryMin = 60f / (currentWeather.cloudChance * currentWeather.cloudDriftSpeed) // if chance = 0, the result will be +inf
if (cloudUpdateAkku >= cloudChanceEveryMin) {
while (cloudUpdateAkku >= cloudChanceEveryMin) {
cloudUpdateAkku -= cloudChanceEveryMin
tryToSpawnCloud(currentWeather)
}
@@ -257,6 +257,7 @@ internal object WeatherMixer : RNGConsumer {
}
private val scrHscaler = App.scr.height / 720f
private val cloudSizeMult = App.scr.wf / TerrarumScreenSize.defaultW
/**
* @param range: range of the randomised number
@@ -281,8 +282,6 @@ internal object WeatherMixer : RNGConsumer {
val rC = takeUniformRand(0f..1f)
val rZ = takeUniformRand(1f..ALPHA_ROLLOFF_Z/4f).pow(1.5f) // clouds are more likely to spawn with low Z-value
val rY = takeUniformRand(-1f..1f)
val r1 = takeUniformRand(-1f..1f)
val r2 = takeUniformRand(-1f..1f)
val rT1 = takeTriangularRand(-1f..1f)
val (rA, rB) = doubleToLongBits(Math.random()).let {
it.ushr(20).and(0xFFFF).toInt() to it.ushr(36).and(0xFFFF).toInt()
@@ -308,7 +307,7 @@ internal object WeatherMixer : RNGConsumer {
val sheetX = rA % cloud.spriteSheet.horizontalCount
val sheetY = rB % cloud.spriteSheet.verticalCount
WeatherObjectCloud(cloud.spriteSheet.get(sheetX, sheetY), flip).also {
it.scale = cloudScale
it.scale = cloudScale * cloudSizeMult
it.posX = posX
it.posY = posY