mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 01:54:04 +09:00
fix: model having wrong turbidity value
This commit is contained in:
@@ -211,9 +211,9 @@ class Application(val WIDTH: Int, val HEIGHT: Int) : Game() {
|
|||||||
|
|
||||||
oneScreen = Pixmap(outTexWidth, outTexHeight, Pixmap.Format.RGBA8888)
|
oneScreen = Pixmap(outTexWidth, outTexHeight, Pixmap.Format.RGBA8888)
|
||||||
|
|
||||||
DatasetSpectral
|
// DatasetSpectral
|
||||||
DatasetCIEXYZ
|
DatasetCIEXYZ
|
||||||
DatasetRGB
|
// DatasetRGB
|
||||||
|
|
||||||
ApplicationController(this)
|
ApplicationController(this)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ object Skybox : Disposable {
|
|||||||
|
|
||||||
val elevationDeg = (it / turbCnt).plus(elevations.first).toDouble()
|
val elevationDeg = (it / turbCnt).plus(elevations.first).toDouble()
|
||||||
val elevationRad = Math.toRadians(elevationDeg)
|
val elevationRad = Math.toRadians(elevationDeg)
|
||||||
val turbidity = 1.0 + (it % turbCnt) / 100.0
|
val turbidity = 1.0 + (it % turbCnt) / 2.0
|
||||||
|
|
||||||
val state = ArHosekSkyModel.arhosek_xyz_skymodelstate_alloc_init(turbidity, albedo, elevationRad.abs())
|
val state = ArHosekSkyModel.arhosek_xyz_skymodelstate_alloc_init(turbidity, albedo, elevationRad.abs())
|
||||||
val pixmap = Pixmap(1, gradSize, Pixmap.Format.RGBA8888)
|
val pixmap = Pixmap(1, gradSize, Pixmap.Format.RGBA8888)
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var turbidity = 2.0
|
private var turbidity = 4.0
|
||||||
private var gH = 2f * App.scr.height
|
private var gH = 2f * App.scr.height
|
||||||
|
|
||||||
private val HALF_DAY = DAY_LENGTH / 2
|
private val HALF_DAY = DAY_LENGTH / 2
|
||||||
@@ -158,7 +158,6 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
val parallaxZeroPos = (world.height / 3f)
|
val parallaxZeroPos = (world.height / 3f)
|
||||||
val parallaxDomainSize = world.height / 6f
|
val parallaxDomainSize = world.height / 6f
|
||||||
|
|
||||||
|
|
||||||
// we will not care for nextSkybox for now
|
// we will not care for nextSkybox for now
|
||||||
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
|
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
|
||||||
val daylightClut = currentWeather.daylightClut
|
val daylightClut = currentWeather.daylightClut
|
||||||
@@ -166,7 +165,6 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
val globalLight = getGradientColour2(daylightClut, world.worldTime.solarElevationDeg, timeNow)
|
val globalLight = getGradientColour2(daylightClut, world.worldTime.solarElevationDeg, timeNow)
|
||||||
globalLightNow.set(globalLight)
|
globalLightNow.set(globalLight)
|
||||||
|
|
||||||
|
|
||||||
/* (copied from the shader source)
|
/* (copied from the shader source)
|
||||||
UV mapping coord.y
|
UV mapping coord.y
|
||||||
|
|
||||||
@@ -190,8 +188,8 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
val degThis = deg.floor()
|
val degThis = deg.floor()
|
||||||
val degNext = degThis + if (timeNow < HALF_DAY) 1 else -1 // Skybox.get has internal coerceIn
|
val degNext = degThis + if (timeNow < HALF_DAY) 1 else -1 // Skybox.get has internal coerceIn
|
||||||
|
|
||||||
val texture1 = Skybox.get(degThis, turbidity)
|
val texture1 = Skybox[degThis, turbidity]
|
||||||
val texture2 = Skybox.get(degNext, turbidity)
|
val texture2 = Skybox[degNext, turbidity]
|
||||||
val lerpScale = (if (timeNow < HALF_DAY) deg - degThis else 1f - (deg - degThis)).toFloat()
|
val lerpScale = (if (timeNow < HALF_DAY) deg - degThis else 1f - (deg - degThis)).toFloat()
|
||||||
|
|
||||||
val gradY = -(gH - App.scr.height) * ((parallax + 1f) / 2f)
|
val gradY = -(gH - App.scr.height) * ((parallax + 1f) / 2f)
|
||||||
@@ -209,8 +207,6 @@ internal object WeatherMixer : RNGConsumer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Float.clampOne() = if (this > 1) 1f else this
|
|
||||||
|
|
||||||
private operator fun Color.times(other: Color) = Color(this.r * other.r, this.g * other.g, this.b * other.b, 1f)
|
private operator fun Color.times(other: Color) = Color(this.r * other.r, this.g * other.g, this.b * other.b, 1f)
|
||||||
|
|
||||||
fun colorMix(one: Color, two: Color, scale: Float): Color {
|
fun colorMix(one: Color, two: Color, scale: Float): Color {
|
||||||
|
|||||||
Reference in New Issue
Block a user