yet another sky model changes

This commit is contained in:
minjaesong
2023-07-26 00:09:47 +09:00
parent e04d0284bb
commit 5495552db5
2 changed files with 5 additions and 2 deletions

View File

@@ -185,7 +185,8 @@ class Application(val WIDTH: Int, val HEIGHT: Int) : Game() {
val theta = sqrt(xf*xf + yf*yf) * HALF_PI*/
// AM-PM mapping (use with WIDTH=1)
val yf = (y * 2.0 / oneScreen.height) % 1.0
var yf = (y * 2.0 / oneScreen.height) % 1.0
if (elevation < 0) yf -= (elevation / HALF_PI)
val gamma = if (y < halfHeight) HALF_PI else 3 * HALF_PI
val theta = yf.mapCircle() * HALF_PI

View File

@@ -103,7 +103,9 @@ object Skybox : Disposable {
// printdbg(this, "elev $elevationDeg turb $turbidity")
for (y in 0 until gradSize) {
val theta = (y.toDouble() / gradSize * 1.0).coerceIn(0.0, 1.0).mapCircle() * HALF_PI
var yf = (y.toDouble() / gradSize * 1.0).coerceIn(0.0, 1.0)
if (elevationDeg < 0) yf += (elevationDeg / 90.0)
val theta = yf.mapCircle() * HALF_PI
// vertical angle, where 0 is zenith, ±90 is ground (which is odd)
val xyz = CIEXYZ(