mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
3f67215df9
commit
8c29c4f620
3 changed files with 25 additions and 11 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue