clouds are now spawned mid-frame

This commit is contained in:
minjaesong
2023-12-05 16:37:37 +09:00
parent fb7a2a3c49
commit 0d290dfc1f
3 changed files with 21 additions and 3 deletions

View File

@@ -3,7 +3,7 @@
"skyboxGradColourMap": "generic_skybox.tga",
"daylightClut": "clut_daylight.tga",
"classification": "generic",
"cloudChance": 125,
"cloudChance": 60,
"cloudGamma": [0.9, 2.4],
"cloudGammaVariance": [0.111, 0.0],
"windSpeed": 0.35,

View File

@@ -3,7 +3,7 @@
"skyboxGradColourMap": "generic_skybox.tga",
"daylightClut": "clut_daylight.tga",
"classification": "generic2",
"cloudChance": 800,
"cloudChance": 150,
"cloudGamma": [0.9, 2.4],
"cloudGammaVariance": [0.111, 0.0],
"windSpeed": 0.35,

View File

@@ -356,9 +356,25 @@ internal object WeatherMixer : RNGConsumer {
)
/**
* Returns random point for clouds to spawn from, in the opposite side of the current wind vector
* Spawn anywhere on the visible field
*/
private fun getCloudSpawningPosition(cloud: CloudProps, halfCloudSize: Float, windVector: Vector3): Vector3 {
val Z_POW_BASE = ALPHA_ROLLOFF_Z / 4f
val y = takeUniformRand(-cloud.altHigh..-cloud.altLow) * scrHscaler
val z = takeUniformRand(1f..Z_POW_BASE).pow(1.5f) // clouds are more likely to spawn with low Z-value
val xlow = WeatherObjectCloud.screenXtoWorldX(-halfCloudSize, z)
val xhi = WeatherObjectCloud.screenXtoWorldX(App.scr.width + halfCloudSize, z)
val x = takeUniformRand(xlow..xhi)
return Vector3(x, y, z)
}
/**
* Returns random point for clouds to spawn from, in the opposite side of the current wind vector
*/
private fun getCloudSpawningPositionOLD(cloud: CloudProps, halfCloudSize: Float, windVector: Vector3): Vector3 {
val Z_LIM = ALPHA_ROLLOFF_Z
val Z_POW_BASE = ALPHA_ROLLOFF_Z / 4f
val y = takeUniformRand(-cloud.altHigh..-cloud.altLow) * scrHscaler
@@ -416,6 +432,8 @@ internal object WeatherMixer : RNGConsumer {
else -> throw InternalError()
}
}
private fun tryToSpawnCloud(