From: ehofman Date: Fri, 12 Mar 2004 18:55:22 +0000 (+0000) Subject: Limmit the change in sun color due to visibility to a saner range. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ce3a1ddcb0f29e8e0239a8f92b286313d8eb0b36;p=simgear.git Limmit the change in sun color due to visibility to a saner range. --- diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 2458736e..11c7f894 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -341,9 +341,10 @@ bool SGSun::repaint( double sun_angle, double new_visibility ) { if (prev_sun_angle != sun_angle) { prev_sun_angle = sun_angle; - double vis_factor = (new_visibility - 5000.0) / 10000.0; - if ( vis_factor < 0.0 ) { - vis_factor = 0.0; + double nv = (new_visibility > 5000.0) ? new_visibility : 5000.0; + double vis_factor = 10000.0 / (nv - 5000.0); + if ( vis_factor < 0.25 ) { + vis_factor = 0.25; } else if ( vis_factor > 1.0) { vis_factor = 1.0; }