aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/game.cpp1
-rw-r--r--src/client/sky.cpp7
-rw-r--r--src/client/sky.h1
3 files changed, 7 insertions, 2 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 81a996c08..e6308c3b6 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -2876,6 +2876,7 @@ void Game::handleClientEvent_SetStars(ClientEvent *event, CameraOrientation *cam
sky->setStarCount(event->star_params->count);
sky->setStarColor(event->star_params->starcolor);
sky->setStarScale(event->star_params->scale);
+ sky->setStarDayOpacity(event->star_params->day_opacity);
delete event->star_params;
}
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();
diff --git a/src/client/sky.h b/src/client/sky.h
index e03683f12..cbb1186aa 100644
--- a/src/client/sky.h
+++ b/src/client/sky.h
@@ -82,6 +82,7 @@ public:
void setStarCount(u16 star_count);
void setStarColor(video::SColor star_color) { m_star_params.starcolor = star_color; }
void setStarScale(f32 star_scale) { m_star_params.scale = star_scale; updateStars(); }
+ void setStarDayOpacity(f32 day_opacity) { m_star_params.day_opacity = day_opacity; }
bool getCloudsVisible() const { return m_clouds_visible && m_clouds_enabled; }
const video::SColorf &getCloudColor() const { return m_cloudcolor_f; }