]> git.mxchange.org Git - flightgear.git/commitdiff
Add a property to be able to turn the bump-mapped cloud code on and off at runtime.
authorehofman <ehofman>
Thu, 20 May 2004 13:27:40 +0000 (13:27 +0000)
committerehofman <ehofman>
Thu, 20 May 2004 13:27:40 +0000 (13:27 +0000)
src/Main/fg_init.cxx
src/Main/main.cxx

index 4556c9e5759b7455bfaa976a91e13960f62ccca6..b9ed5d85cef877c01dc278d873716d3feeb6a51f 100644 (file)
@@ -1587,6 +1587,10 @@ bool fgInitSubsystems() {
 
     globals->add_subsystem("lighting", new FGLight);
 
+    //////////////////////////////////////////////////////////////////////
+    // Initialize the 2D cloud subsystem.
+    ////////////////////////////////////////////////////////////////////
+    fgGetNode("/sim/rendering/bump-mapping", true);
 
 #ifdef FG_USE_CLOUDS_3D
     ////////////////////////////////////////////////////////////////////
index 809ae0a32c571721f28d65fe77078180ff6357b0..1f7032f8a5f47566ebcefcd513032bbc79255be1 100644 (file)
@@ -331,7 +331,7 @@ void trRenderFrame( void ) {
             //  and update the stencil buffer with 1
             glEnable( GL_STENCIL_TEST );
             glStencilFunc( GL_ALWAYS, 1, 1 );
-            glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
+            glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
         }
         FGTileMgr::set_tile_filter( false );
         sgSetModelFilter( true );
@@ -701,7 +701,7 @@ void fgRenderFrame() {
                     //  and update the stencil buffer with 1
                     glEnable( GL_STENCIL_TEST );
                     glStencilFunc( GL_ALWAYS, 1, 1 );
-                    glStencilOp( GL_REPLACE, GL_REPLACE, GL_REPLACE );
+                    glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );
                 }
                 FGTileMgr::set_tile_filter( false );
                 sgSetModelFilter( true );
@@ -1018,6 +1018,8 @@ static void fgMainLoop( void ) {
     // static const SGPropertyNode *replay_master
     //     = fgGetNode("/sim/freeze/replay", true);
 
+    SGCloudLayer::enable_bump_mapping = fgGetBool("/sim/rendering/bump-mapping",true);
+
     // Update the elapsed time.
     static bool first_time = true;
     if ( first_time ) {
@@ -1769,9 +1771,14 @@ bool fgMainInit( int argc, char **argv ) {
 
     // build our custom render states
     fgBuildRenderStates();
-    
-    // pass control off to the master event handler
-    fgOSMainLoop();
+
+    try {
+        // pass control off to the master event handler
+        fgOSMainLoop();
+    } catch (...) {
+        SG_LOG( SG_ALL, SG_ALERT,
+            "Unknown exception in the main loop. Aborting..." );
+    }
 
     // we never actually get here ... but to avoid compiler warnings,
     // etc.