aboutsummaryrefslogtreecommitdiff
path: root/src/client/sky.cpp
diff options
context:
space:
mode:
authorWuzzy <Wuzzy@disroot.org>2022-07-02 18:57:48 +0000
committerGitHub <noreply@github.com>2022-07-02 19:57:48 +0100
commit142928e944db089cccce6c0ea32a89b32300b3d1 (patch)
tree666fa8664a4a0a4d2d365d24ff61448e257759cc /src/client/sky.cpp
parentb095dc4f2bf2a1ace010dfae0ead69654b0ca3ac (diff)
downloadminetest-142928e944db089cccce6c0ea32a89b32300b3d1.tar.gz
minetest-142928e944db089cccce6c0ea32a89b32300b3d1.tar.bz2
minetest-142928e944db089cccce6c0ea32a89b32300b3d1.zip
Allow to set maximum star opacity at daytime (#11663)
Diffstat (limited to 'src/client/sky.cpp')
-rw-r--r--src/client/sky.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/client/sky.cpp b/src/client/sky.cpp
index 0ab710eee..ca56889b4 100644
--- a/src/client/sky.cpp
+++ b/src/client/sky.cpp
@@ -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();