]> git.mxchange.org Git - simgear.git/commitdiff
Initialize some variables before using them
authorehofman <ehofman>
Wed, 17 Sep 2003 17:59:28 +0000 (17:59 +0000)
committerehofman <ehofman>
Wed, 17 Sep 2003 17:59:28 +0000 (17:59 +0000)
simgear/scene/sky/oursun.cxx
simgear/scene/sky/oursun.hxx

index 0bce1594a3510e1de385680c798f5b66c380a64e..923ae3f832b2b81a4f8c962c8e5441873e21eaf7 100644 (file)
@@ -113,6 +113,8 @@ static int sgSunHaloPostDraw( ssgEntity *e ) {
 
 // Constructor
 SGSun::SGSun( void ) {
+    prev_sun_angle = -9999.0;
+    visibility = -9999.0;
 }
 
 
@@ -335,17 +337,14 @@ ssgBranch * SGSun::build( SGPath path, double sun_size ) {
 // 90 degrees = sun rise/set
 // 180 degrees = darkest midnight
 bool SGSun::repaint( double sun_angle, double new_visibility ) {
-    static float prev_sun_angle = 9999.0;
-
     if ( visibility != new_visibility ) {
-        static double sqrt_m_log01 = sqrt( -log( 0.01 ) );
         visibility = new_visibility;
+
+        static double sqrt_m_log01 = sqrt( -log( 0.01 ) );
         sun_exp2_punch_through = sqrt_m_log01 / (visibility * 15);
     }
 
-    if (prev_sun_angle != sun_angle)
-    {
-
+    if (prev_sun_angle != sun_angle) {
         prev_sun_angle = sun_angle;
 
         float sun_factor = 4*cos(sun_angle);
index 212acdc8c11cade1dd2021f2f42191a23fb4eb69..981c54410f9ab6c48a4e4c3d512d032d87a428c4 100644 (file)
@@ -51,6 +51,7 @@ class SGSun {
     GLubyte *sun_texbuf;
 
     double visibility;
+    double prev_sun_angle;
 
 public: