aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-12-02 04:17:05 +0000
committerGitHub <noreply@github.com>2018-12-02 04:17:05 +0000
commit5dd542401a3537928b6a730eb534c3eb239e8308 (patch)
treef54e190c94a31158066043307a8f18296d915b28 /src
parent327bad2eafb8cfc05b7f831992be5700a167a53c (diff)
downloadminetest-5dd542401a3537928b6a730eb534c3eb239e8308.tar.gz
minetest-5dd542401a3537928b6a730eb534c3eb239e8308.tar.bz2
minetest-5dd542401a3537928b6a730eb534c3eb239e8308.zip
Slightly alter star appearence time and full brightness time (#7921)
At sunset: Stars first appear slightly later, at the time the sun disappears over the horizon, this fixes seeing dark stars in front of the sun horizon glow texture. Stars reach full brightness slightly earlier at time 20000, not so excessively long after sunset. The above behaviour is also applied at sunrise, but of course, time-inverted.
Diffstat (limited to 'src')
-rw-r--r--src/client/sky.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/client/sky.cpp b/src/client/sky.cpp
index 7c5f2e253..4df51b4eb 100644
--- a/src/client/sky.cpp
+++ b/src/client/sky.cpp
@@ -445,12 +445,16 @@ void Sky::render()
// Draw stars
do {
driver->setMaterial(m_materials[1]);
+ // Tune values, so that stars begin to be drawn at the same time the
+ // sun disappears over the horizon, and so that star full brightness
+ // is reached at time 20000, for 8 'hours' of full star brightness.
float starbrightness = MYMAX(0, MYMIN(1,
- (0.285 - fabs(wicked_time_of_day < 0.5 ?
- wicked_time_of_day : (1.0 - wicked_time_of_day))) * 10));
+ (0.25 - fabs(wicked_time_of_day < 0.5 ?
+ wicked_time_of_day : (1.0 - wicked_time_of_day))) * 20));
float f = starbrightness;
- float d = 0.007/2;
+ float d = 0.007 / 2;
video::SColor starcolor(255, f * 90, f * 90, f * 90);
+ // Stars are only drawn when brighter than skycolor
if (starcolor.getBlue() < m_skycolor.getBlue())
break;
#ifdef __ANDROID__