]> git.mxchange.org Git - flightgear.git/commitdiff
Patch from Jim Wilson:
authordavid <david>
Sat, 30 Mar 2002 12:52:24 +0000 (12:52 +0000)
committerdavid <david>
Sat, 30 Mar 2002 12:52:24 +0000 (12:52 +0000)
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

index 1067ef38dbcfe2880848bbca4b0c975d9fd40dc8..69d0a7822ba12079bf6729ae9fcd8d360348cc9e 100644 (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
 
+