Initialize some variables before using them

This commit is contained in:
ehofman 2003-09-17 17:59:28 +00:00
parent 6f4fd2dc6e
commit 6079cd3df8
2 changed files with 6 additions and 6 deletions

View 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);

View File

@ -51,6 +51,7 @@ class SGSun {
GLubyte *sun_texbuf;
double visibility;
double prev_sun_angle;
public: