From bdccfb587d002a97a04a2f9bb480be9e80faaa55 Mon Sep 17 00:00:00 2001 From: ehofman Date: Mon, 27 Apr 2009 20:26:28 +0000 Subject: [PATCH] brighten te sky color towards the sun at dusk and dawn --- src/Time/light.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 226d1839d..88a215f98 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -191,8 +191,8 @@ void FGLight::update_sky_color () { // calculate lighting parameters based on sun's relative angle to // local up - float av = thesky->get_visibility(); - if (av > 45000.0) av = 45000.0; + static SGConstPropertyNode_ptr humidity = fgGetNode("/environment/relative-humidity"); + float av = humidity->getFloatValue() * 45; float visibility_log = log(av)/11.0; float visibility_inv = (45000.0 - av)/45000.0; @@ -316,17 +316,16 @@ void FGLight::update_adj_fog_color () { // Calculate the fog color in the direction of the sun for // sunrise/sunset effects. // - float s_red = (_fog_color[0] + 2 * sun_color[0]*sun_color[0]) / 3; - float s_green = (_fog_color[1] + 2 * sun_color[1]*sun_color[1]) / 3; - float s_blue = (_fog_color[2] + 2 * sun_color[2]) / 3; + float s_red = sun_color[0]*sun_color[0]; + float s_green = sun_color[1]*sun_color[1]; + float s_blue = sun_color[2]; // interpolate beween the sunrise/sunset color and the color // at the opposite direction of this effect. Take in account // the current visibility. // float av = thesky->get_visibility(); - if (av > 45000) - av = 45000; + if (av > 45000) av = 45000; float avf = 0.87 - (45000 - av) / 83333.33; float sif = 0.5 - cos(_sun_angle*2)/2; @@ -335,7 +334,7 @@ void FGLight::update_adj_fog_color () { sif = 1e-4; float rf1 = fabs((hor_rotation - SGD_PI) / SGD_PI); // 0.0 .. 1.0 - float rf2 = avf * pow(rf1 * rf1, 1/sif) * 1.0639; + float rf2 = avf * pow(rf1*rf1, 1/sif) * 1.0639; float rf3 = 1.0 - rf2; _adj_fog_color[0] = rf3 * _fog_color[0] + rf2 * s_red; -- 2.39.5