diff options
author | MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com> | 2014-04-30 16:38:26 +0300 |
---|---|---|
committer | RealBadAngel <maciej.kasatkin@o2.pl> | 2014-12-08 01:44:28 +0100 |
commit | c5f6656f998457450b036285713f49854249cc13 (patch) | |
tree | 2699cdc158426452979222ce9282e744b1c7feb7 /src | |
parent | 5c55738276bb6875c3f2d4702b7fd08c45e8a29c (diff) | |
download | minetest-c5f6656f998457450b036285713f49854249cc13.tar.gz minetest-c5f6656f998457450b036285713f49854249cc13.tar.bz2 minetest-c5f6656f998457450b036285713f49854249cc13.zip |
Make directional fog colors respect tonemap
Diffstat (limited to 'src')
-rw-r--r-- | src/sky.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/sky.cpp b/src/sky.cpp index b5706f4e3..00072f17f 100644 --- a/src/sky.cpp +++ b/src/sky.cpp @@ -607,14 +607,31 @@ void Sky::update(float time_of_day, float time_brightness, // invert direction to match where the sun and moon are rising if (m_time_of_day > 0.5) pointcolor_blend = 1 - pointcolor_blend; - // horizon colors of sun and moon f32 pointcolor_light = rangelim(m_time_brightness * 3, 0.2, 1); + video::SColorf pointcolor_sun_f(1, 1, 1, 1); - pointcolor_sun_f.r = pointcolor_light * 1; - pointcolor_sun_f.b = pointcolor_light * (0.25 + (rangelim(m_time_brightness, 0.25, 0.75) - 0.25) * 2 * 0.75); - pointcolor_sun_f.g = pointcolor_light * (pointcolor_sun_f.b * 0.375 + (rangelim(m_time_brightness, 0.05, 0.15) - 0.05) * 10 * 0.625); + if (m_sun_tonemap) + { + pointcolor_sun_f.r = pointcolor_light * (float)m_materials[3].EmissiveColor.getRed() / 255; + pointcolor_sun_f.b = pointcolor_light * (float)m_materials[3].EmissiveColor.getBlue() / 255; + pointcolor_sun_f.g = pointcolor_light * (float)m_materials[3].EmissiveColor.getGreen() / 255; + } + else + { + pointcolor_sun_f.r = pointcolor_light * 1; + pointcolor_sun_f.b = pointcolor_light * (0.25 + (rangelim(m_time_brightness, 0.25, 0.75) - 0.25) * 2 * 0.75); + pointcolor_sun_f.g = pointcolor_light * (pointcolor_sun_f.b * 0.375 + (rangelim(m_time_brightness, 0.05, 0.15) - 0.05) * 10 * 0.625); + } + video::SColorf pointcolor_moon_f(0.5 * pointcolor_light, 0.6 * pointcolor_light, 0.8 * pointcolor_light, 1); + if (m_moon_tonemap) + { + pointcolor_moon_f.r = pointcolor_light * (float)m_materials[4].EmissiveColor.getRed() / 255; + pointcolor_moon_f.b = pointcolor_light * (float)m_materials[4].EmissiveColor.getBlue() / 255; + pointcolor_moon_f.g = pointcolor_light * (float)m_materials[4].EmissiveColor.getGreen() / 255; + } + video::SColor pointcolor_sun = pointcolor_sun_f.toSColor(); video::SColor pointcolor_moon = pointcolor_moon_f.toSColor(); // calculate the blend color |