diff options
author | Perttu Ahola <celeron55@gmail.com> | 2013-08-03 19:04:16 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2013-08-03 19:04:16 +0300 |
commit | bc5db9b0273d43fffad93cf67cf2bfdb714441a9 (patch) | |
tree | 9837b96570a26346415fd3125612e23b11bc2487 /src | |
parent | c50c9a10f12fb28724b30ec0db00aee39c4a1414 (diff) | |
download | minetest-bc5db9b0273d43fffad93cf67cf2bfdb714441a9.tar.gz minetest-bc5db9b0273d43fffad93cf67cf2bfdb714441a9.tar.bz2 minetest-bc5db9b0273d43fffad93cf67cf2bfdb714441a9.zip |
Lessen the sky color glitch when quickly turning to look up after looking at ground that contains caves
Diffstat (limited to 'src')
-rw-r--r-- | src/sky.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/sky.cpp b/src/sky.cpp index 22b12ca1b..e55dd1eb2 100644 --- a/src/sky.cpp +++ b/src/sky.cpp @@ -433,9 +433,14 @@ void Sky::update(float time_of_day, float time_brightness, //video::SColorf cloudcolor_bright_dawn_f(1.0, 0.65, 0.44); video::SColorf cloudcolor_bright_dawn_f(1.0, 0.7, 0.5); + float cloud_color_change_fraction = 0.95; if(sunlight_seen){ - //m_brightness = m_brightness * 0.95 + direct_brightness * 0.05; - m_brightness = m_brightness * 0.95 + time_brightness * 0.05; + if(fabs(time_brightness - m_brightness) < 0.2){ + m_brightness = m_brightness * 0.95 + time_brightness * 0.05; + } else { + m_brightness = m_brightness * 0.80 + time_brightness * 0.20; + cloud_color_change_fraction = 0.0; + } } else{ if(direct_brightness < m_brightness) @@ -493,8 +498,8 @@ void Sky::update(float time_of_day, float time_brightness, } else { cloud_direct_brightness = direct_brightness; } - m_cloud_brightness = m_cloud_brightness * 0.95 + - cloud_direct_brightness * (1.0 - 0.95); + m_cloud_brightness = m_cloud_brightness * cloud_color_change_fraction + + cloud_direct_brightness * (1.0 - cloud_color_change_fraction); m_cloudcolor_f = video::SColorf( m_cloudcolor_bright_f.getRed() * m_cloud_brightness, m_cloudcolor_bright_f.getGreen() * m_cloud_brightness, |