weatherbox is now owned by the world

This commit is contained in:
minjaesong
2023-09-04 14:59:12 +09:00
parent 08b1d93d54
commit 7b3ac9cd06
23 changed files with 260 additions and 146 deletions

View File

@@ -25,6 +25,7 @@ data class BaseModularWeather(
val cloudChance: Float,
val windSpeed: Float,
val windSpeedVariance: Float,
val windSpeedDamping: Float,
val cloudGamma: Vector2,
val cloudGammaVariance: Vector2,
var clouds: List<CloudProps>, // sorted by CloudProps.probability
@@ -36,9 +37,10 @@ data class BaseModularWeather(
/**
* @param rnd random number between -1 and +1
*/
fun getRandomWindSpeed(rnd: Float): Float {
fun getRandomWindSpeed(old: Float, rnd: Float): Float {
val v = 1f + rnd.absoluteValue * windSpeedVariance
return if (rnd < 0) windSpeed / v else windSpeed * v
val r = if (rnd < 0) windSpeed / v else windSpeed * v
return FastMath.interpolateLinear(windSpeedDamping, old, r)
}
fun getRandomCloudGamma(rnd1: Float, rnd2: Float): Vector2 {