mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
skybox model changes on negative deg
This commit is contained in:
@@ -22,6 +22,8 @@ Seed
|
||||
SetAV
|
||||
SetBulletin
|
||||
SetScale
|
||||
SetSol
|
||||
SetTurb
|
||||
SetTime
|
||||
SetTimeDelta
|
||||
SpawnPhysTestBall
|
||||
|
||||
|
@@ -30,7 +30,7 @@ internal object SetGlobalLightOverride : ConsoleCommand {
|
||||
}
|
||||
|
||||
}
|
||||
else if (args.size == 2 && args[1].trim().toLowerCase() == "none") {
|
||||
else if (args.size == 2 && args[1].trim().lowercase() == "none") {
|
||||
WeatherMixer.globalLightOverridden = false
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -52,8 +52,9 @@ object Skybox : Disposable {
|
||||
)
|
||||
}
|
||||
else {
|
||||
val elevation1 = -elevationDeg
|
||||
val elevation2 = -elevationDeg / 28.5
|
||||
val deg1 = (-elevationDeg / 75.0).pow(0.8).times(-75.0)
|
||||
val elevation1 = -deg1
|
||||
val elevation2 = -deg1 / 28.5
|
||||
val scale = (1f - (1f - 1f / 1.8.pow(elevation1)) * 0.97f).toFloat()
|
||||
val scale2 = (1.0 - (elevation2.pow(E) / E.pow(elevation2))*0.8).toFloat()
|
||||
CIEXYZ(
|
||||
@@ -65,7 +66,7 @@ object Skybox : Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
private val elevations = (-75..75) // 151
|
||||
private val elevations = (-75..75) //zw 151
|
||||
private val elevationsD = (elevations.first.toDouble() .. elevations.last.toDouble())
|
||||
private val turbidities = (1_0..10_0 step 1) // 99
|
||||
private val turbiditiesD = (turbidities.first / 10.0..turbidities.last / 10.0)
|
||||
|
||||
37
src/net/torvald/terrarum/modulebasegame/console/SetSol.kt
Normal file
37
src/net/torvald/terrarum/modulebasegame/console/SetSol.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2023-07-25.
|
||||
*/
|
||||
internal object SetSol : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
if (args[1].trim().lowercase() == "none") {
|
||||
WeatherMixer.forceSolarElev = null
|
||||
}
|
||||
else {
|
||||
try {
|
||||
val solarAngle = args[1].toDouble().coerceIn(-75.0..75.0)
|
||||
WeatherMixer.forceSolarElev = solarAngle
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
Echo("Wrong number input.")
|
||||
}
|
||||
catch (e1: IllegalArgumentException) {
|
||||
Echo("Range: -75.0-75.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("usage: setsol <-75.0..75.0 or 'none'>")
|
||||
}
|
||||
}
|
||||
37
src/net/torvald/terrarum/modulebasegame/console/SetTurb.kt
Normal file
37
src/net/torvald/terrarum/modulebasegame/console/SetTurb.kt
Normal file
@@ -0,0 +1,37 @@
|
||||
package net.torvald.terrarum.modulebasegame.console
|
||||
|
||||
import net.torvald.terrarum.console.ConsoleCommand
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2023-07-25.
|
||||
*/
|
||||
object SetTurb : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
if (args[1].trim().lowercase() == "none") {
|
||||
WeatherMixer.forceTurbidity = null
|
||||
}
|
||||
else {
|
||||
try {
|
||||
val turbidity = args[1].toDouble().coerceIn(1.0..10.0)
|
||||
WeatherMixer.forceTurbidity = turbidity
|
||||
}
|
||||
catch (e: NumberFormatException) {
|
||||
Echo("Wrong number input.")
|
||||
}
|
||||
catch (e1: IllegalArgumentException) {
|
||||
Echo("Range: 1.0-10.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
printUsage()
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("usage: setturb <1.0..10.0 or 'none'>")
|
||||
}
|
||||
}
|
||||
@@ -197,12 +197,16 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
|
||||
|
||||
// sun and weather
|
||||
val soldeg = world?.worldTime?.solarElevationDeg
|
||||
val soldeg = WeatherMixer.forceSolarElev ?: world?.worldTime?.solarElevationDeg
|
||||
val soldegStr = (soldeg ?: 0.0).toIntAndFrac(3,2)
|
||||
val soldegNeg = ((soldeg ?: 0.0) >= 0.0).toInt()
|
||||
val turbidity = WeatherMixer.turbidity
|
||||
App.fontSmallNumbers.draw(batch, "$SOL $ccG$soldegStr", gap + 7f*(sol), line(mvY))
|
||||
App.fontSmallNumbers.draw(batch, "$TAU $ccG$turbidity", gap + 7f*(sol), line(mvY + 1))
|
||||
val turbidity = WeatherMixer.forceTurbidity ?: WeatherMixer.turbidity
|
||||
|
||||
val soldegCol = if (WeatherMixer.forceSolarElev != null) ccO else ccG
|
||||
val turbCol = if (WeatherMixer.forceTurbidity != null) ccO else ccG
|
||||
|
||||
App.fontSmallNumbers.draw(batch, "$SOL $soldegCol$soldegStr", gap + 7f*(sol), line(mvY))
|
||||
App.fontSmallNumbers.draw(batch, "$TAU $turbCol$turbidity", gap + 7f*(sol), line(mvY + 1))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ internal object WeatherMixer : RNGConsumer {
|
||||
// TODO to save from GL overhead, store lightmap to array; use GdxColorMap
|
||||
|
||||
var forceTimeAt: Int? = null
|
||||
var forceSolarElev: Double? = null
|
||||
var forceTurbidity: Double? = null
|
||||
|
||||
override fun loadFromSave(s0: Long, s1: Long) {
|
||||
super.loadFromSave(s0, s1)
|
||||
@@ -68,6 +70,8 @@ internal object WeatherMixer : RNGConsumer {
|
||||
fun internalReset() {
|
||||
globalLightOverridden = false
|
||||
forceTimeAt = null
|
||||
forceSolarElev = null
|
||||
forceTurbidity = null
|
||||
}
|
||||
|
||||
init {
|
||||
@@ -160,7 +164,9 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
// we will not care for nextSkybox for now
|
||||
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
|
||||
val solarElev = if (forceTimeAt != null)
|
||||
val solarElev = if (forceSolarElev != null)
|
||||
forceSolarElev!!
|
||||
else if (forceTimeAt != null)
|
||||
world.worldTime.getSolarElevationAt(world.worldTime.ordinalDay, forceTimeAt!!)
|
||||
else
|
||||
world.worldTime.solarElevationDeg
|
||||
@@ -185,12 +191,16 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
gdxBlendNormalStraightAlpha()
|
||||
|
||||
val degThis = solarElev.floorToDouble()
|
||||
val degThis = if (timeNow < HALF_DAY) solarElev.floorToDouble() else solarElev.ceilToDouble()
|
||||
val degNext = degThis + if (timeNow < HALF_DAY) 1 else -1 // Skybox.get has internal coerceIn
|
||||
|
||||
val texture1 = Skybox[degThis, turbidity]
|
||||
val texture2 = Skybox[degNext, turbidity]
|
||||
val lerpScale = (if (timeNow < HALF_DAY) solarElev - degThis else 1f - (solarElev - degThis)).toFloat()
|
||||
val thisTurbidity = forceTurbidity ?: turbidity
|
||||
|
||||
val texture1 = Skybox[degThis, thisTurbidity]
|
||||
val texture2 = Skybox[degNext, thisTurbidity]
|
||||
val lerpScale = (if (timeNow < HALF_DAY) solarElev - degThis else -(solarElev - degThis)).toFloat()
|
||||
|
||||
// println("degThis=$degThis, degNext=$degNext, lerp=$lerpScale")
|
||||
|
||||
val gradY = -(gH - App.scr.height) * ((parallax + 1f) / 2f)
|
||||
batch.inUse {
|
||||
|
||||
Reference in New Issue
Block a user