More ssg tweaks.
This commit is contained in:
parent
0c25cad3a1
commit
0ae48876a7
8 changed files with 78 additions and 22 deletions
|
@ -696,7 +696,7 @@ void guiInit()
|
||||||
// Install our fast fonts
|
// Install our fast fonts
|
||||||
fntpath.append( "typewriter.txf" );
|
fntpath.append( "typewriter.txf" );
|
||||||
guiFntHandle = new fntTexFont ;
|
guiFntHandle = new fntTexFont ;
|
||||||
guiFntHandle -> load ( fntpath.c_str() ) ;
|
guiFntHandle -> load ( (char *)fntpath.c_str() ) ;
|
||||||
puFont GuiFont ( guiFntHandle, 15 ) ;
|
puFont GuiFont ( guiFntHandle, 15 ) ;
|
||||||
puSetDefaultFonts( GuiFont, GuiFont ) ;
|
puSetDefaultFonts( GuiFont, GuiFont ) ;
|
||||||
guiFnt = puGetDefaultLabelFont();
|
guiFnt = puGetDefaultLabelFont();
|
||||||
|
|
|
@ -4,7 +4,7 @@ else
|
||||||
SERIAL_LIBS =
|
SERIAL_LIBS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS += -DPKGLIBDIR=\"$(pkglibdir)\"
|
CPPFLAGS += -DUSE_SSG -DPKGLIBDIR=\"$(pkglibdir)\"
|
||||||
|
|
||||||
EXTRA_DIST = 3dfx.sh runfgfs.in runfgfs.bat.in
|
EXTRA_DIST = 3dfx.sh runfgfs.in runfgfs.bat.in
|
||||||
|
|
||||||
|
|
|
@ -182,8 +182,6 @@ static void fgInitVisuals( void ) {
|
||||||
|
|
||||||
// xglFogi (GL_FOG_MODE, GL_LINEAR);
|
// xglFogi (GL_FOG_MODE, GL_LINEAR);
|
||||||
xglFogi (GL_FOG_MODE, GL_EXP2);
|
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) ||
|
if ( (current_options.get_fog() == 1) ||
|
||||||
(current_options.get_shading() == 0) ) {
|
(current_options.get_shading() == 0) ) {
|
||||||
// if fastest fog requested, or if flat shading force fastest
|
// if fastest fog requested, or if flat shading force fastest
|
||||||
|
@ -354,11 +352,12 @@ static void fgRenderFrame( void ) {
|
||||||
xglEnable( GL_DEPTH_TEST );
|
xglEnable( GL_DEPTH_TEST );
|
||||||
if ( current_options.get_fog() > 0 ) {
|
if ( current_options.get_fog() > 0 ) {
|
||||||
xglEnable( GL_FOG );
|
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
|
// set lighting parameters
|
||||||
xglLightfv(GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
|
xglLightfv( GL_LIGHT0, GL_AMBIENT, l->scene_ambient );
|
||||||
xglLightfv(GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
|
xglLightfv( GL_LIGHT0, GL_DIFFUSE, l->scene_diffuse );
|
||||||
// xglLightfv(GL_LIGHT0, GL_SPECULAR, white );
|
// xglLightfv(GL_LIGHT0, GL_SPECULAR, white );
|
||||||
|
|
||||||
if ( current_options.get_textures() ) {
|
if ( current_options.get_textures() ) {
|
||||||
|
@ -383,12 +382,25 @@ static void fgRenderFrame( void ) {
|
||||||
|
|
||||||
// ssg test
|
// ssg test
|
||||||
|
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode( GL_PROJECTION );
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
ssgSetFOV(60.0f, 0.0f);
|
ssgSetFOV( current_options.get_fov(), 0.0f );
|
||||||
ssgSetNearFar(10.0f, 14000.0f);
|
|
||||||
sgMat4 sgTRANS;
|
|
||||||
|
|
||||||
|
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,
|
sgMakeTransMat4( sgTRANS,
|
||||||
current_view.view_pos.x()
|
current_view.view_pos.x()
|
||||||
+ current_view.view_forward[0] * 20,
|
+ current_view.view_forward[0] * 20,
|
||||||
|
|
|
@ -239,10 +239,10 @@ void FGView::UpdateViewParams( void ) {
|
||||||
xglMatrixMode(GL_PROJECTION);
|
xglMatrixMode(GL_PROJECTION);
|
||||||
xglLoadIdentity();
|
xglLoadIdentity();
|
||||||
if ( f->get_Altitude() * FEET_TO_METER - scenery.cur_elev > 10.0 ) {
|
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);
|
gluPerspective(current_options.get_fov(), win_ratio, 10.0, 100000.0);
|
||||||
} else {
|
} else {
|
||||||
ssgSetNearFar( 0.5, 100000.0 );
|
// ssgSetNearFar( 0.5, 100000.0 );
|
||||||
gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
|
gluPerspective(current_options.get_fov(), win_ratio, 0.5, 100000.0);
|
||||||
// printf("Near ground, minimizing near clip plane\n");
|
// printf("Near ground, minimizing near clip plane\n");
|
||||||
}
|
}
|
||||||
|
@ -379,7 +379,6 @@ void FGView::UpdateViewParams( void ) {
|
||||||
}
|
}
|
||||||
#endif // FG_VIEW_INLINE_OPTIMIZATIONS
|
#endif // FG_VIEW_INLINE_OPTIMIZATIONS
|
||||||
|
|
||||||
|
|
||||||
panel_hist = current_options.get_panel_status();
|
panel_hist = current_options.get_panel_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ FGTileCache::fill_in( int index, const FGBucket& p )
|
||||||
void
|
void
|
||||||
FGTileCache::entry_free( int index )
|
FGTileCache::entry_free( int index )
|
||||||
{
|
{
|
||||||
tile_cache[index].release_fragments();
|
tile_cache[index].free_tile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,17 +55,57 @@ FGTileEntry::~FGTileEntry ( void ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Step through the fragment list, deleting the display list, then
|
// Step through the fragment list, deleting the display list, then the
|
||||||
// the fragment, until the list is empty.
|
// fragment, until the list is empty. Also delete the arrays used by
|
||||||
|
// ssg as well as the whole ssg branch
|
||||||
void
|
void
|
||||||
FGTileEntry::release_fragments()
|
FGTileEntry::free_tile()
|
||||||
{
|
{
|
||||||
FG_LOG( FG_TERRAIN, FG_DEBUG,
|
FG_LOG( FG_TERRAIN, FG_DEBUG,
|
||||||
"FREEING TILE = (" << tile_bucket << ")" );
|
"FREEING TILE = (" << tile_bucket << ")" );
|
||||||
|
|
||||||
|
// mark tile unused
|
||||||
|
mark_unused();
|
||||||
|
|
||||||
|
// delete fragment list
|
||||||
for_each( begin(), end(),
|
for_each( begin(), end(),
|
||||||
mem_fun_ref( &fgFRAGMENT::deleteDisplayList ));
|
mem_fun_ref( &fgFRAGMENT::deleteDisplayList ));
|
||||||
fragment_list.erase( begin(), end() );
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -136,8 +136,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step through the fragment list, deleting the display list, then
|
// Step through the fragment list, deleting the display list, then
|
||||||
// the fragment, until the list is empty.
|
// the fragment, until the list is empty. Also delete the arrays
|
||||||
void release_fragments();
|
// used by ssg as well as the whole ssg branch
|
||||||
|
void free_tile();
|
||||||
|
|
||||||
// Calculate this tile's offset
|
// Calculate this tile's offset
|
||||||
void SetOffset( const Point3D& off)
|
void SetOffset( const Point3D& off)
|
||||||
|
|
|
@ -45,6 +45,7 @@ public:
|
||||||
inline double get_visibility() const { return visibility; }
|
inline double get_visibility() const { return visibility; }
|
||||||
|
|
||||||
inline void set_visibility( double v ) {
|
inline void set_visibility( double v ) {
|
||||||
|
xglMatrixMode(GL_MODELVIEW);
|
||||||
// in meters
|
// in meters
|
||||||
visibility = v;
|
visibility = v;
|
||||||
|
|
||||||
|
@ -56,8 +57,11 @@ public:
|
||||||
|
|
||||||
// Set correct opengl fog density
|
// Set correct opengl fog density
|
||||||
xglFogf (GL_FOG_DENSITY, fog_exp2_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 );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue