diff options
author | Paramat <paramat@users.noreply.github.com> | 2018-10-01 19:43:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-01 19:43:32 +0100 |
commit | dc948382f57c34a7da358bba85c04513877fe2c3 (patch) | |
tree | fde6bd3c2c236696a4a6e87d8fc5d6b5f2f8f2ae /src | |
parent | a29bc8e8babd9320b629e67dee753a08d18799d3 (diff) | |
download | minetest-dc948382f57c34a7da358bba85c04513877fe2c3.tar.gz minetest-dc948382f57c34a7da358bba85c04513877fe2c3.tar.bz2 minetest-dc948382f57c34a7da358bba85c04513877fe2c3.zip |
Night clouds: Boost brightness for a moonlit appearence (#7748)
Previously, night clouds were almost indistinguishable from night sky,
especially since a recent commit that made night sky brighter.
They were lacking the beautiful luminosity caused by being lit by the
permanently-full moon.
When 'directional_colored_fog = false' allow the dawn/dusk cloud
brightness boost to apply through the night too.
Set an identical minimum cloud brightness for when
'directional_colored_fog = true'.
Diffstat (limited to 'src')
-rw-r--r-- | src/sky.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/sky.cpp b/src/sky.cpp index 8c5959d1c..8ae45d144 100644 --- a/src/sky.cpp +++ b/src/sky.cpp @@ -721,15 +721,20 @@ void Sky::update(float time_of_day, float time_brightness, m_skycolor = m_mix_scolor(m_skycolor, pointcolor, m_horizon_blend() * 0.25); } - float cloud_direct_brightness = 0; + float cloud_direct_brightness = 0.0f; if (sunlight_seen) { if (!m_directional_colored_fog) { cloud_direct_brightness = time_brightness; - if (time_brightness >= 0.2 && time_brightness < 0.7) - cloud_direct_brightness *= 1.3; + // Boost cloud brightness relative to sky, at dawn, dusk and at night + if (time_brightness < 0.7f) + cloud_direct_brightness *= 1.3f; } else { - cloud_direct_brightness = MYMIN(m_horizon_blend() * 0.15 + - m_time_brightness, 1); + cloud_direct_brightness = std::fmin(m_horizon_blend() * 0.15f + + m_time_brightness, 1.0f); + // Set the same minimum cloud brightness at night + if (time_brightness < 0.5f) + cloud_direct_brightness = std::fmax(cloud_direct_brightness, + time_brightness * 1.3f); } } else { cloud_direct_brightness = direct_brightness; |