aboutsummaryrefslogtreecommitdiff
path: root/src/client/game.cpp
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-08-17 16:30:05 +0200
committerGitHub <noreply@github.com>2022-08-17 16:30:05 +0200
commit8c29c4f620a45385ac4e906c1f50d1df7d1edba9 (patch)
treeb0e3373136418f6159201cecc0fd7450fe29fc67 /src/client/game.cpp
parent3f67215df9dbc16f3bfe1ffc5c2582a308532914 (diff)
downloadminetest-8c29c4f620a45385ac4e906c1f50d1df7d1edba9.tar.xz
Use Sky class to obtain directional light source position for shadows (#12662)
* Also remove unused Sky::getSkyBodyOrbitTilt method Fixes misalignment of sun position and shadow direction at high tilt values.
Diffstat (limited to 'src/client/game.cpp')
-rw-r--r--src/client/game.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 0e86de496..34bfb5aa6 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -4065,10 +4065,7 @@ void Game::updateShadows()
timeoftheday = fmod(timeoftheday + 0.75f, 0.5f) + 0.25f;
const float offset_constant = 10000.0f;
- v3f light(0.0f, 0.0f, -1.0f);
- light.rotateXZBy(90);
- light.rotateXYBy(timeoftheday * 360 - 90);
- light.rotateYZBy(sky->getSkyBodyOrbitTilt());
+ v3f light = is_day ? sky->getSunDirection() : sky->getMoonDirection();
v3f sun_pos = light * offset_constant;