]> git.mxchange.org Git - flightgear.git/commitdiff
More ssg tweaks.
authorcurt <curt>
Tue, 29 Jun 1999 14:57:00 +0000 (14:57 +0000)
committercurt <curt>
Tue, 29 Jun 1999 14:57:00 +0000 (14:57 +0000)
src/GUI/gui.cxx
src/Main/Makefile.am
src/Main/main.cxx
src/Main/views.cxx
src/Scenery/tilecache.cxx
src/Scenery/tileentry.cxx
src/Scenery/tileentry.hxx
src/Weather/weather.hxx

index 4ccceb468a82ba222fda1e7fa1a4d0a266be09ce..165a00c1f8cac02e26c56479be8d8d0431306853 100644 (file)
@@ -696,7 +696,7 @@ void guiInit()
     // Install our fast fonts
     fntpath.append( "typewriter.txf" );
     guiFntHandle = new fntTexFont ;
-    guiFntHandle -> load ( fntpath.c_str() ) ;
+    guiFntHandle -> load ( (char *)fntpath.c_str() ) ;
     puFont GuiFont ( guiFntHandle, 15 ) ;
     puSetDefaultFonts( GuiFont, GuiFont ) ;
     guiFnt = puGetDefaultLabelFont();
index 604871337d76433704f89f28de5ee46051c79e60..a6492a22b29da85f1aead074bf6e0c14449df071 100644 (file)
@@ -4,7 +4,7 @@ else
 SERIAL_LIBS =
 endif
 
-CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
+CPPFLAGS += -DUSE_SSG -DPKGLIBDIR=\"$(pkglibdir)\"
 
 EXTRA_DIST = 3dfx.sh runfgfs.in runfgfs.bat.in
 
index c26b29d7644198021631066f5a156cb59363dfb9..0f8b6a544af12f4e8da0af074c5bad6045583d70 100644 (file)
@@ -182,8 +182,6 @@ static void fgInitVisuals( void ) {
 
     // xglFogi (GL_FOG_MODE, GL_LINEAR);
     xglFogi (GL_FOG_MODE, GL_EXP2);
-    // Fog density is now set when the weather system is initialized
-    // xglFogf (GL_FOG_DENSITY, w->fog_density);
     if ( (current_options.get_fog() == 1) || 
         (current_options.get_shading() == 0) ) {
        // if fastest fog requested, or if flat shading force fastest
@@ -354,11 +352,12 @@ static void fgRenderFrame( void ) {
        xglEnable( GL_DEPTH_TEST );
        if ( current_options.get_fog() > 0 ) {
            xglEnable( GL_FOG );
-           xglFogfv (GL_FOG_COLOR, l->adj_fog_color);
+           xglFogi( GL_FOG_MODE, GL_EXP2 );
+           xglFogfv( GL_FOG_COLOR, l->adj_fog_color );
        }
        // set lighting parameters
-       xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
-       xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
+       xglLightfv( GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
+       xglLightfv( GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
        // xglLightfv(GL_LIGHT0, GL_SPECULAR, white );
        
        if ( current_options.get_textures() ) {
@@ -383,12 +382,25 @@ static void fgRenderFrame( void ) {
 
        // ssg test
 
-       xglMatrixMode(GL_PROJECTION);
+       xglMatrixMode( GL_PROJECTION );
        xglLoadIdentity();
-       ssgSetFOV(60.0f, 0.0f);
-       ssgSetNearFar(10.0f, 14000.0f);
-       sgMat4 sgTRANS;
+       ssgSetFOV( current_options.get_fov(), 0.0f );
+
+       double agl = current_aircraft.fdm_state->get_Altitude() * FEET_TO_METER
+           - scenery.cur_elev;
+
+       FG_LOG( FG_ALL, FG_INFO, "visibility is " 
+               << current_weather.get_visibility() );
+           
+       if ( agl > 10.0 ) {
+           // ssgSetNearFar( 10.0f, current_weather.get_visibility() );
+           ssgSetNearFar( 10.0f, 100000.0f );
+       } else {
+           // ssgSetNearFar( 0.5f, current_weather.get_visibility() );
+           ssgSetNearFar( 0.5f, 100000.0f );
+       }
 
+       sgMat4 sgTRANS;
        sgMakeTransMat4( sgTRANS, 
                         current_view.view_pos.x() 
                         + current_view.view_forward[0] * 20,
index b8cd9ce603ed37c593792afd78edbb9955d52417..c6f6eba4f2b9fa4583098f4f0b57e2c115a61398 100644 (file)
@@ -239,10 +239,10 @@ void FGView::UpdateViewParams( void ) {
     xglMatrixMode(GL_PROJECTION);
     xglLoadIdentity();
     if ( f->get_Altitude() * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
-       ssgSetNearFar( 10.0, 100000.0 );
+       // ssgSetNearFar( 10.0, 100000.0 );
        gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
     } else {
-       ssgSetNearFar( 0.5, 100000.0 );
+       // ssgSetNearFar( 0.5, 100000.0 );
        gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
        // printf("Near ground, minimizing near clip plane\n");
     }
@@ -378,7 +378,6 @@ void FGView::UpdateViewParams( void ) {
        xglLoadMatrixf( m );
     }
 #endif // FG_VIEW_INLINE_OPTIMIZATIONS
-       
 
     panel_hist = current_options.get_panel_status();
 }
index 234abf1ddd6f1bf4d3ecc171364396bd3cf5893f..188aa3e8dccddec5637532f3fca22d3ec963b79a 100644 (file)
@@ -161,7 +161,7 @@ FGTileCache::fill_in( int index, const FGBucket& p )
 void
 FGTileCache::entry_free( int index )
 {
-    tile_cache[index].release_fragments();
+    tile_cache[index].free_tile();
 }
 
 
index d90f465f263cb0e6a4926d707155d87a9d81c69d..3c66667d51112293641a23cd52eb2e68de1dbb33 100644 (file)
@@ -55,17 +55,57 @@ FGTileEntry::~FGTileEntry ( void ) {
 }
 
 
-// Step through the fragment list, deleting the display list, then
-// the fragment, until the list is empty.
+// Step through the fragment list, deleting the display list, then the
+// fragment, until the list is empty.  Also delete the arrays used by
+// ssg as well as the whole ssg branch
 void
-FGTileEntry::release_fragments()
+FGTileEntry::free_tile()
 {
     FG_LOG( FG_TERRAIN, FG_DEBUG,
            "FREEING TILE = (" << tile_bucket << ")" );
+
+    // mark tile unused
+    mark_unused();
+
+    // delete fragment list
     for_each( begin(), end(),
              mem_fun_ref( &fgFRAGMENT::deleteDisplayList ));
     fragment_list.erase( begin(), end() );
-    mark_unused();
+
+    // delete the ssg used structures
+    delete vtlist;
+    delete vnlist;
+    delete tclist;
+
+    // delete the ssg branch
+
+    // make sure we have a sane number of parents
+    int pcount = branch_ptr->getNumParents();
+    if ( pcount > 0 ) {
+       // find the first parent (should only be one)
+       ssgBranch *parent = branch_ptr->getParent( 0 ) ;
+       // find the number of kids this parent has
+       int kcount = parent->getNumKids();
+       // find the kid that matches our original branch_ptr
+       bool found_kid = false;
+       for ( int i = 0; i < kcount; ++i ) {
+           ssgEntity *kid = parent->getKid( i );
+           if ( kid == branch_ptr ) {
+               FG_LOG( FG_TERRAIN, FG_INFO,
+                       "Found a kid to delete " << kid);
+               found_kid = true;
+           }
+       }
+       if ( ! found_kid ) {
+           FG_LOG( FG_TERRAIN, FG_ALERT,
+                   "Couldn't find the kid to delete!  Dying" );
+           exit(-1);
+       }
+    } else {
+       FG_LOG( FG_TERRAIN, FG_ALERT,
+               "Parent count is zero for an ssg tile!  Dying" );
+       exit(-1);
+    }    
 }
 
 
index 719536110b167e19f8dd4334b991b9c39e5f23a2..1a80f53c7b91d5422d5150cdd54d9a160d02cb06 100644 (file)
@@ -136,8 +136,9 @@ public:
     }
 
     // Step through the fragment list, deleting the display list, then
-    // the fragment, until the list is empty.
-    void release_fragments();
+    // the fragment, until the list is empty.  Also delete the arrays
+    // used by ssg as well as the whole ssg branch
+    void free_tile();
 
     // Calculate this tile's offset
     void SetOffset( const Point3D& off)
index 22896793614b3d401185d436eec2b89b6d766324..355a1a20d3fe537afbe5ecc53d40b5eb07b1c7d5 100644 (file)
@@ -45,6 +45,7 @@ public:
     inline double get_visibility() const { return visibility; }
 
     inline void set_visibility( double v ) {
+       xglMatrixMode(GL_MODELVIEW);
        // in meters
        visibility = v;
 
@@ -56,8 +57,11 @@ public:
 
        // Set correct opengl fog density
        xglFogf (GL_FOG_DENSITY, fog_exp2_density);
+       xglFogi( GL_FOG_MODE, GL_EXP2 );
 
-       // FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << w->fog_density );
+       // FG_LOG( FG_INPUT, FG_DEBUG, "Fog density = " << fog_density );
+       FG_LOG( FG_INPUT, FG_INFO, 
+               "Fog exp2 density = " << fog_exp2_density );
     }
 };