1
0
Fork 0

Patch from Jim Wilson:

Clear frame buffer and render model after rest of 3D scene. This has a
small frame rate cost (YMV). But who thought 3D cockpit would be cheap?
If anyone has a better idea, have at it!

Just did some more careful testing and I see little or no frame rate loss
with the depth buffer clear.  Also you can change the near plane to 0.1
and get rid of the "sunroof" (so I don't have to make up another set of
patches.
This commit is contained in:
david 2002-03-30 12:52:24 +00:00
parent 50e25151e1
commit faf2fa91d2

View file

@ -138,7 +138,7 @@ FGTileEntry *dummy_tile;
sgVec3 rway_ols;
// ADA
// Clip plane settings...
float cockpit_nearplane = 0.2f;
float cockpit_nearplane = 0.1f;
float cockpit_farplane = 120000.0f;
float scene_nearplane = 0.5f;
float scene_farplane = 120000.0f;
@ -640,14 +640,10 @@ void fgRenderFrame( void ) {
// draw the ssg scene
glEnable( GL_DEPTH_TEST );
ssgSetNearFar( scene_nearplane, scene_farplane );
ssgCullAndDraw( scene );
// if in cockpit view adjust nearfar...
if (globals->get_current_view()->getType() == 0 )
ssgSetNearFar( cockpit_nearplane, cockpit_farplane );
ssgCullAndDraw( cockpit );
// change state for lighting here
// draw lighting
@ -692,6 +688,7 @@ void fgRenderFrame( void ) {
ssgSetNearFar( scene_nearplane, scene_farplane );
ssgCullAndDraw( lighting );
#ifdef FG_EXPERIMENTAL_LIGHTING
if (glutExtensionSupported("GL_EXT_point_parameters")) {
// Disable states used for runway lighting
@ -711,6 +708,16 @@ void fgRenderFrame( void ) {
thesky->postDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
}
// if in cockpit view adjust nearfar...
if (globals->get_current_view()->getType() == 0 ) {
glClearDepth(1);
glClear(GL_DEPTH_BUFFER_BIT);
ssgSetNearFar( cockpit_nearplane, cockpit_farplane );
ssgCullAndDraw( cockpit );
} else {
ssgCullAndDraw( cockpit );
}
// display HUD && Panel
glDisable( GL_FOG );
glDisable( GL_DEPTH_TEST );
@ -1898,3 +1905,4 @@ void fgUpdateDCS (void) {
// $$$ end - added VS Renganathan, 15 Oct 2K
// added Venky , 12 Nov 2K