]> git.mxchange.org Git - simgear.git/commitdiff
Limmit the change in sun color due to visibility to a saner range.
authorehofman <ehofman>
Fri, 12 Mar 2004 18:55:22 +0000 (18:55 +0000)
committerehofman <ehofman>
Fri, 12 Mar 2004 18:55:22 +0000 (18:55 +0000)
simgear/scene/sky/oursun.cxx

index 2458736e6b60ce68dd78052513d2ddd2d69a8cef..11c7f8940bd094bfbaf78ef1a056e17b53ad0883 100644 (file)
@@ -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;
         }