mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02: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:
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user