aboutsummaryrefslogtreecommitdiff
path: root/src/sky.cpp
diff options
context:
space:
mode:
authorParamat <paramat@users.noreply.github.com>2018-11-12 22:25:35 +0000
committerGitHub <noreply@github.com>2018-11-12 22:25:35 +0000
commit85b01eacd22060e332fada4895ac2cafd04b106a (patch)
tree8df94c65811e87533e91eec5fcc1127948bd4271 /src/sky.cpp
parent98ee08904b3a11d9b64a95edebd4d8852d4a2301 (diff)
downloadminetest-85b01eacd22060e332fada4895ac2cafd04b106a.tar.gz
minetest-85b01eacd22060e332fada4895ac2cafd04b106a.tar.bz2
minetest-85b01eacd22060e332fada4895ac2cafd04b106a.zip
Night sky: Fix brightness threshold for applying night colours (#7859)
Previously, 'time_brightness' never fell below the threshold so night sky colours were not applied. Increase the threshold value. But now also set it to a value less sensitive to possible future small changes in 'time_brightness', by setting it halfway between the 'time_brightness' values for darkest night and first stage of dawn.
Diffstat (limited to 'src/sky.cpp')
-rw-r--r--src/sky.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sky.cpp b/src/sky.cpp
index 8ae45d144..faf12ba92 100644
--- a/src/sky.cpp
+++ b/src/sky.cpp
@@ -610,9 +610,9 @@ void Sky::update(float time_of_day, float time_brightness,
}
m_clouds_visible = true;
- float color_change_fraction = 0.98;
+ float color_change_fraction = 0.98f;
if (sunlight_seen) {
- if (is_dawn) { // Dawn
+ if (is_dawn) { // Dawn
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_dawn_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
@@ -620,12 +620,12 @@ void Sky::update(float time_of_day, float time_brightness,
m_cloudcolor_bright_f = m_cloudcolor_bright_f.getInterpolated(
cloudcolor_bright_dawn_f, color_change_fraction);
} else {
- if (time_brightness < 0.07) { // Night
+ if (time_brightness < 0.13f) { // Night
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_night_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(
skycolor_bright_night_f, color_change_fraction);
- } else { // Day
+ } else { // Day
m_bgcolor_bright_f = m_bgcolor_bright_f.getInterpolated(
bgcolor_bright_normal_f, color_change_fraction);
m_skycolor_bright_f = m_skycolor_bright_f.getInterpolated(