]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/sky/oursun.cxx
Update the SoundSample api so we can request that a copy of the sample be
[simgear.git] / simgear / scene / sky / oursun.cxx
index 9d4794a4bf068628901972dd5da8528e52e185b9..10c6129a46f02db28b4a1bf1472a372b01fc8b0c 100644 (file)
@@ -49,6 +49,8 @@
 #include "sphere.hxx"
 #include "oursun.hxx"
 
+static double sun_exp2_punch_through;
+
 // Set up sun rendering call backs
 static int sgSunOrbPreDraw( ssgEntity *e ) {
     /* cout << endl << "Sun orb pre draw" << endl << "----------------" 
@@ -341,11 +343,19 @@ bool SGSun::repaint( double sun_angle, double new_visibility ) {
     if (prev_sun_angle != sun_angle) {
         prev_sun_angle = sun_angle;
 
-        float sun_factor = 4*cos(sun_angle);
+        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;
+        }
+
+        float sun_factor = 4 * (cos(sun_angle) + cos(sun_angle)/2) * vis_factor;
 
         if (sun_factor > 1) sun_factor = 1.0;
         if (sun_factor < -1) sun_factor = -1.0;
-        sun_factor = sun_factor/2 + 0.5;
+        sun_factor = (sun_factor/2) + 0.5;
 
         sgVec4 color;
         color[1] = sqrt(sun_factor);