// 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();
SERIAL_LIBS =
endif
-CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
+CPPFLAGS += -DUSE_SSG -DPKGLIBDIR=\"$(pkglibdir)\"
EXTRA_DIST = 3dfx.sh runfgfs.in runfgfs.bat.in
// 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
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() ) {
// 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,
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");
}
xglLoadMatrixf( m );
}
#endif // FG_VIEW_INLINE_OPTIMIZATIONS
-
panel_hist = current_options.get_panel_status();
}
void
FGTileCache::entry_free( int index )
{
- tile_cache[index].release_fragments();
+ tile_cache[index].free_tile();
}
}
-// 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);
+ }
}
}
// 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)
inline double get_visibility() const { return visibility; }
inline void set_visibility( double v ) {
+ xglMatrixMode(GL_MODELVIEW);
// in meters
visibility = v;
// 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 );
}
};