From 6079cd3df8f0dfa02bcb70d7b4ab0af29f087b22 Mon Sep 17 00:00:00 2001 From: ehofman Date: Wed, 17 Sep 2003 17:59:28 +0000 Subject: [PATCH] Initialize some variables before using them --- simgear/scene/sky/oursun.cxx | 11 +++++------ simgear/scene/sky/oursun.hxx | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/simgear/scene/sky/oursun.cxx b/simgear/scene/sky/oursun.cxx index 0bce1594..923ae3f8 100644 --- a/simgear/scene/sky/oursun.cxx +++ b/simgear/scene/sky/oursun.cxx @@ -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); diff --git a/simgear/scene/sky/oursun.hxx b/simgear/scene/sky/oursun.hxx index 212acdc8..981c5441 100644 --- a/simgear/scene/sky/oursun.hxx +++ b/simgear/scene/sky/oursun.hxx @@ -51,6 +51,7 @@ class SGSun { GLubyte *sun_texbuf; double visibility; + double prev_sun_angle; public: -- 2.39.5