1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow to set maximum star opacity at daytime (#11663)

This commit is contained in:
Wuzzy 2022-07-02 18:57:48 +00:00 committed by GitHub
parent b095dc4f2b
commit 142928e944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 24 additions and 4 deletions

View file

@ -660,9 +660,12 @@ void Sky::draw_stars(video::IVideoDriver * driver, float wicked_time_of_day)
// to time 4000.
float tod = wicked_time_of_day < 0.5f ? wicked_time_of_day : (1.0f - wicked_time_of_day);
float starbrightness = (0.25f - fabsf(tod)) * 20.0f;
float day_opacity = clamp(m_star_params.day_opacity, 0.0f, 1.0f);
float starbrightness = (0.25f - fabs(tod)) * 20.0f;
float alpha = clamp(starbrightness, day_opacity, 1.0f);
m_star_color = m_star_params.starcolor;
m_star_color.a *= clamp(starbrightness, 0.0f, 1.0f);
m_star_color.a *= alpha;
if (m_star_color.a <= 0.0f) // Stars are only drawn when not fully transparent
return;
m_materials[0].DiffuseColor = m_materials[0].EmissiveColor = m_star_color.toSColor();