From 832fab27e455257107db3e13a3b36a79dc0e2600 Mon Sep 17 00:00:00 2001 From: Bixilon Date: Wed, 12 May 2021 00:53:46 +0200 Subject: [PATCH] rendering: fix sun invisible bug when time == 6000t --- ReadMe.md | 1 - .../de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index 40af16708..04ad6e5c1 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -85,7 +85,6 @@ See [Credits](Credits.md). ## Releases and beta No clue, but still waiting for !21. Also, some features need to be implemented, so not soo soon (but we are getting closer). If you want to get notified about cool new changes, feel free to subscribe to our dev news telegram channel [@MinosoftDevNews]((https://t.me/MinosoftDevNews)) - ## Compiling and running 1. Install Maven and java 15 (On Ubuntu based distributions: `sudo apt install maven openjdk-15-jdk`). diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt index fb7464b22..9b78fc4d5 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/sky/SkyRenderer.kt @@ -77,7 +77,12 @@ class SkyRenderer( private fun setSunMatrix(projectionViewMatrix: Mat4) { val timeAngle = (getSkyAngle(connection.world.time).toFloat() * 360.0f) - skySunShader.use().setMat4("skyViewProjectionMatrix", projectionViewMatrix.rotate(timeAngle, Vec3(0.0f, 0.0f, 1.0f))) // ToDo: 180° is top, not correct yet + val rotatedMatrix = if (timeAngle == 0.0f) { + projectionViewMatrix + } else { + projectionViewMatrix.rotate(timeAngle, Vec3(0.0f, 0.0f, 1.0f)) + } + skySunShader.use().setMat4("skyViewProjectionMatrix", rotatedMatrix) // ToDo: 180° is top, not correct yet } override fun postInit() { @@ -103,7 +108,7 @@ class SkyRenderer( start = Vec3(-0.15f, 1.0f, -0.15f), end = Vec3(+0.15f, 1.0f, +0.15f), texture = sunTexture, - tintColor = RGBColor(255, 255, 255), + tintColor = RGBColor(255, 255, 255), // ToDo: Depends on time ) skySunMesh.load() }