From faf2fa91d232f804b1d5b74f79e06e4625ce09fd Mon Sep 17 00:00:00 2001 From: david Date: Sat, 30 Mar 2002 12:52:24 +0000 Subject: [PATCH] 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. --- src/Main/main.cxx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Main/main.cxx b/src/Main/main.cxx index 1067ef38d..69d0a7822 100644 --- a/src/Main/main.cxx +++ b/src/Main/main.cxx @@ -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 + -- 2.39.5