From 3433dbce55643493ec0d5742ca9fb703b929ca98 Mon Sep 17 00:00:00 2001 From: ehofman Date: Sun, 15 Jun 2003 11:30:25 +0000 Subject: [PATCH] Take the visibility in account for the sky color --- src/Time/light.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 83d2edfff..a55127ca0 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -56,6 +56,7 @@ SG_USING_STD(string); #include #include
+#include
#include
#include "light.hxx" @@ -229,12 +230,19 @@ void fgLIGHT::UpdateAdjFog( void ) { float s_blue = (fog_color[2] + 2 * sun_color[2]) / 3; // interpolate beween the sunrise/sunset color and the color - // at the opposite direction of this effect. + // at the opposite direction of this effect. Take in account + // the current visibility. // + float av = thesky->get_visibility(); + if (av > 45000) + av = 45000; + + float avf = 0.87 - (45000 - av) / 83333.33; float sif = 0.5 - cos(sun_angle*2)/2; + float rf1 = fabs((rotation - SGD_PI) / SGD_PI); // 0.0 .. 1.0 - float rf2 = 0.87 * pow(rf1 * rf1, 1/sif); - float rf3 = 1.0 - rf2; + float rf2 = avf * pow(rf1 * rf1, 1/sif); + float rf3 = 0.94 - rf2; adj_fog_color[0] = rf3 * fog_color[0] + rf2 * s_red; adj_fog_color[1] = rf3 * fog_color[1] + rf2 * s_green; -- 2.39.5