cloud spawn z-pos probability change

This commit is contained in:
minjaesong
2023-08-22 16:33:39 +09:00
parent 547158a313
commit a21f986f30
2 changed files with 4 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ import java.util.*
import kotlin.collections.ArrayList
import kotlin.collections.HashMap
import kotlin.math.absoluteValue
import kotlin.math.pow
/**
* Currently there is a debate whether this module must be part of the engine or the basegame
@@ -278,7 +279,7 @@ internal object WeatherMixer : RNGConsumer {
if (cloudsSpawned < cloudSpawnMax) {
val flip = Math.random() < 0.5
val rC = takeUniformRand(0f..1f)
val rZ = takeUniformRand(1f..ALPHA_ROLLOFF_Z)
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)

View File

@@ -37,7 +37,7 @@ class WeatherObjectCloud(private val texture: TextureRegion, private val flipW:
fun update(flowVector: Vector3, gait: Float) {
pos.add(flowVector.cpy().scl(vecMult).scl(gait))
alpha = -(posZ / ALPHA_ROLLOFF_Z).pow(1.703f) + 1f
alpha = -(posZ / ALPHA_ROLLOFF_Z).pow(1f) + 1f
val lrCoord = screenCoordBottomLR
if (lrCoord.x > WeatherMixer.oobMarginR || lrCoord.z < WeatherMixer.oobMarginL || posZ !in 0.05f..ALPHA_ROLLOFF_Z || alpha < 1f / 255f) {
@@ -100,6 +100,6 @@ class WeatherObjectCloud(private val texture: TextureRegion, private val flipW:
companion object {
fun screenXtoWorldX(screenX: Float, z: Float) = screenX * z - App.scr.halfwf * (z - 1f)
const val ALPHA_ROLLOFF_Z = 16f
const val ALPHA_ROLLOFF_Z = 64f
}
}