rendering: fix sun invisible bug when time == 6000t

This commit is contained in:
Bixilon 2021-05-12 00:53:46 +02:00
parent 49fdad2ca2
commit 832fab27e4
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 7 additions and 3 deletions

View File

@ -85,7 +85,6 @@ See [Credits](Credits.md).
## Releases and beta ## 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)) 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 ## Compiling and running
1. Install Maven and java 15 (On Ubuntu based distributions: `sudo apt install maven openjdk-15-jdk`). 1. Install Maven and java 15 (On Ubuntu based distributions: `sudo apt install maven openjdk-15-jdk`).

View File

@ -77,7 +77,12 @@ class SkyRenderer(
private fun setSunMatrix(projectionViewMatrix: Mat4) { private fun setSunMatrix(projectionViewMatrix: Mat4) {
val timeAngle = (getSkyAngle(connection.world.time).toFloat() * 360.0f) 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() { override fun postInit() {
@ -103,7 +108,7 @@ class SkyRenderer(
start = Vec3(-0.15f, 1.0f, -0.15f), start = Vec3(-0.15f, 1.0f, -0.15f),
end = Vec3(+0.15f, 1.0f, +0.15f), end = Vec3(+0.15f, 1.0f, +0.15f),
texture = sunTexture, texture = sunTexture,
tintColor = RGBColor(255, 255, 255), tintColor = RGBColor(255, 255, 255), // ToDo: Depends on time
) )
skySunMesh.load() skySunMesh.load()
} }