mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
This commit is contained in:
parent
8d55702d13
commit
0f25fa7af6
24 changed files with 375 additions and 169 deletions
|
@ -4037,7 +4037,12 @@ void Game::updateShadows()
|
|||
|
||||
float in_timeofday = fmod(runData.time_of_day_smooth, 1.0f);
|
||||
|
||||
float timeoftheday = fmod(getWickedTimeOfDay(in_timeofday) + 0.75f, 0.5f) + 0.25f;
|
||||
float timeoftheday = getWickedTimeOfDay(in_timeofday);
|
||||
bool is_day = timeoftheday > 0.25 && timeoftheday < 0.75;
|
||||
bool is_shadow_visible = is_day ? sky->getSunVisible() : sky->getMoonVisible();
|
||||
shadow->setShadowIntensity(is_shadow_visible ? client->getEnv().getLocalPlayer()->getLighting().shadow_intensity : 0.0f);
|
||||
|
||||
timeoftheday = fmod(timeoftheday + 0.75f, 0.5f) + 0.25f;
|
||||
const float offset_constant = 10000.0f;
|
||||
|
||||
v3f light(0.0f, 0.0f, -1.0f);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue