mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-13 15:16:07 +09:00
wtf was that
This commit is contained in:
@@ -22,6 +22,7 @@ import java.awt.BorderLayout
|
||||
import java.awt.Dimension
|
||||
import java.awt.FlowLayout
|
||||
import java.awt.GridLayout
|
||||
import java.lang.Math.pow
|
||||
import javax.swing.*
|
||||
import kotlin.math.*
|
||||
|
||||
@@ -186,7 +187,7 @@ class Application(val WIDTH: Int, val HEIGHT: Int) : Game() {
|
||||
|
||||
// AM-PM mapping (use with WIDTH=1)
|
||||
var yf = (y * 2.0 / oneScreen.height) % 1.0
|
||||
if (elevation < 0) yf -= (elevation / HALF_PI)
|
||||
if (elevation < 0) yf *= 1.0 - pow(-elevation / HALF_PI, 0.333)
|
||||
val gamma = if (y < halfHeight) HALF_PI else 3 * HALF_PI
|
||||
val theta = yf.mapCircle() * HALF_PI
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.abs
|
||||
import net.torvald.terrarum.modulebasegame.worldgenerator.HALF_PI
|
||||
import java.lang.Math.pow
|
||||
import kotlin.math.*
|
||||
|
||||
/**
|
||||
@@ -103,8 +104,8 @@ object Skybox : Disposable {
|
||||
// printdbg(this, "elev $elevationDeg turb $turbidity")
|
||||
|
||||
for (y in 0 until gradSize) {
|
||||
var yf = (y.toDouble() / gradSize * 1.0).coerceIn(0.0, 1.0)
|
||||
if (elevationDeg < 0) yf += (elevationDeg / 90.0)
|
||||
var yf = (y + 0.5) / gradSize.toDouble()
|
||||
if (elevationDeg < 0) yf *= 1.0 - pow(-elevationDeg / 90.0, 0.333)
|
||||
val theta = yf.mapCircle() * HALF_PI
|
||||
// vertical angle, where 0 is zenith, ±90 is ground (which is odd)
|
||||
|
||||
@@ -117,7 +118,7 @@ object Skybox : Disposable {
|
||||
val rgb = xyz2.toRGB().toColor()
|
||||
|
||||
pixmap.setColor(rgb)
|
||||
pixmap.drawPixel(0, gradSize - 1 - y)
|
||||
pixmap.drawPixel(0, y)
|
||||
}
|
||||
|
||||
val texture = Texture(pixmap).also {
|
||||
|
||||
@@ -152,7 +152,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
}
|
||||
|
||||
var turbidity = 4.0; private set
|
||||
private var gH = 2f * App.scr.height
|
||||
private var gH = 1.5f * App.scr.height
|
||||
|
||||
private val HALF_DAY = DAY_LENGTH / 2
|
||||
/**
|
||||
@@ -160,7 +160,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
*/
|
||||
internal fun render(camera: Camera, batch: FlippingSpriteBatch, world: GameWorld) {
|
||||
val parallaxZeroPos = (world.height / 3f)
|
||||
val parallaxDomainSize = world.height / 6f
|
||||
val parallaxDomainSize = 300f
|
||||
|
||||
// we will not care for nextSkybox for now
|
||||
val timeNow = (forceTimeAt ?: world.worldTime.TIME_T.toInt()) % WorldTime.DAY_LENGTH
|
||||
@@ -206,10 +206,10 @@ internal object WeatherMixer : RNGConsumer {
|
||||
batch.inUse {
|
||||
batch.shader = null
|
||||
batch.color = Color.WHITE
|
||||
batch.drawFlipped(texture1, 0f, gradY, App.scr.wf, gH)
|
||||
batch.draw(texture1, 0f, gradY, App.scr.wf, gH)
|
||||
|
||||
batch.color = Color(1f, 1f, 1f, lerpScale)
|
||||
batch.drawFlipped(texture2, 0f, gradY, App.scr.wf, gH)
|
||||
batch.draw(texture2, 0f, gradY, App.scr.wf, gH)
|
||||
|
||||
batch.color = Color.WHITE
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user