From: curt Date: Sat, 2 Jun 2001 04:21:04 +0000 (+0000) Subject: Fixed a bug in star repainting optimization. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c5ca4db94e82720c3a922e146e23a7a16b7e33a4;p=simgear.git Fixed a bug in star repainting optimization. --- diff --git a/SimGear.dsp b/SimGear.dsp index 1aa6b91e..a8fc058e 100644 --- a/SimGear.dsp +++ b/SimGear.dsp @@ -240,21 +240,6 @@ SOURCE=.\simgear\ephemeris\neptune.cxx # End Source File # Begin Source File -SOURCE=.\simgear\ephemeris\pluto.hxx - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgephem" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgephem" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\ephemeris\saturn.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -428,21 +413,6 @@ SOURCE=.\simgear\io\sg_socket.cxx # PROP Default_Filter "" # Begin Source File -SOURCE=.\simgear\magvar\coremag.hxx - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmagvar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmagvar" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\magvar\coremag.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -661,36 +631,6 @@ SOURCE=.\simgear\metar\Fracpart.cpp # End Source File # Begin Source File -SOURCE=.\simgear\metar\Local.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmetar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmetar" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\metar\Metar.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgmetar" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgmetar" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\metar\MetarReport.cpp !IF "$(CFG)" == "SimGear - Win32 Release" @@ -928,21 +868,6 @@ SOURCE=.\simgear\screen\GLBitmaps.cxx # End Source File # Begin Source File -SOURCE=.\simgear\screen\GLBitmaps.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgscreen" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgscreen" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\screen\screen-dump.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -955,21 +880,6 @@ SOURCE=.\simgear\screen\screen-dump.cxx !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\screen\win32-printer.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgscreen" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgscreen" - -!ENDIF - # End Source File # End Group # Begin Group "Lib_sgserial" @@ -1237,21 +1147,6 @@ SOURCE=.\simgear\xgl\xglUtils.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\simgear\xml\asciitab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\easyxml.cxx !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1267,21 +1162,6 @@ SOURCE=.\simgear\xml\easyxml.cxx # End Source File # Begin Source File -SOURCE=.\simgear\xml\hashtable.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\hashtable.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1297,96 +1177,6 @@ SOURCE=.\simgear\xml\hashtable.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\iasciitab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\latin1tab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\nametab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\utf8tab.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmldef.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmlparse.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmlparse.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1402,21 +1192,6 @@ SOURCE=.\simgear\xml\xmlparse.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\xmlrole.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmlrole.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1432,21 +1207,6 @@ SOURCE=.\simgear\xml\xmlrole.c # End Source File # Begin Source File -SOURCE=.\simgear\xml\xmltok.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\xml\xmltok.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1459,21 +1219,6 @@ SOURCE=.\simgear\xml\xmltok.c !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\xml\xmltok_impl.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_sgxml" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_sgxml" - -!ENDIF - # End Source File # End Group # Begin Group "Lib_z" @@ -1541,21 +1286,6 @@ SOURCE=.\simgear\zlib\deflate.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\deflate.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\gzio.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1586,21 +1316,6 @@ SOURCE=.\simgear\zlib\infblock.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infblock.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\infcodes.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1616,21 +1331,6 @@ SOURCE=.\simgear\zlib\infcodes.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infcodes.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\inffast.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1646,36 +1346,6 @@ SOURCE=.\simgear\zlib\inffast.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\inffast.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\simgear\zlib\inffixed.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\inflate.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1706,21 +1376,6 @@ SOURCE=.\simgear\zlib\inftrees.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\inftrees.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\infutil.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1736,21 +1391,6 @@ SOURCE=.\simgear\zlib\infutil.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\infutil.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\trees.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1766,21 +1406,6 @@ SOURCE=.\simgear\zlib\trees.c # End Source File # Begin Source File -SOURCE=.\simgear\zlib\trees.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - -# End Source File -# Begin Source File - SOURCE=.\simgear\zlib\uncompr.c !IF "$(CFG)" == "SimGear - Win32 Release" @@ -1808,21 +1433,6 @@ SOURCE=.\simgear\zlib\zutil.c !ENDIF -# End Source File -# Begin Source File - -SOURCE=.\simgear\zlib\zutil.h - -!IF "$(CFG)" == "SimGear - Win32 Release" - -# PROP Intermediate_Dir "Release\Lib_z" - -!ELSEIF "$(CFG)" == "SimGear - Win32 Debug" - -# PROP Intermediate_Dir "Debug\Lib_z" - -!ENDIF - # End Source File # End Group # End Target diff --git a/simgear/sky/stars.cxx b/simgear/sky/stars.cxx index 920f2477..0ca2efb4 100644 --- a/simgear/sky/stars.cxx +++ b/simgear/sky/stars.cxx @@ -72,7 +72,9 @@ static int sgStarPostDraw( ssgEntity *e ) { // Constructor -SGStars::SGStars( void ) { +SGStars::SGStars( void ) : +old_phase(-1) +{ } @@ -149,12 +151,12 @@ ssgBranch * SGStars::build( int num, sgdVec3 *star_data, double star_dist ) { // 90 degrees = sun rise/set // 180 degrees = darkest midnight bool SGStars::repaint( double sun_angle, int num, sgdVec3 *star_data ) { + // cout << "repainting stars" << endl; // double min = 100; // double max = -100; double mag, nmag, alpha, factor, cutoff; float *color; - static int old_phase = -1; int phase; // determine which star structure to draw @@ -195,6 +197,7 @@ bool SGStars::repaint( double sun_angle, int num, sgdVec3 *star_data ) { } if( phase != old_phase ) { + // cout << " phase change, repainting stars, num = " << num << endl; old_phase = phase; for ( int i = 0; i < num; ++i ) { // if ( star_data[i][2] < min ) { min = star_data[i][2]; } @@ -225,6 +228,8 @@ bool SGStars::repaint( double sun_angle, int num, sgdVec3 *star_data ) { sgSetVec4( color, 1.0, 1.0, 1.0, alpha ); // cout << "alpha[" << i << "] = " << alpha << endl; } + } else { + // cout << " no phase change, skipping" << endl; } // cout << "min = " << min << " max = " << max << " count = " << num diff --git a/simgear/sky/stars.hxx b/simgear/sky/stars.hxx index 432bc621..4260aad4 100644 --- a/simgear/sky/stars.hxx +++ b/simgear/sky/stars.hxx @@ -41,6 +41,8 @@ class SGStars { ssgColourArray *cl; ssgVertexArray *vl; + int old_phase; // data for optimization + public: // Constructor