]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
Disable two sided light model because Andy's patch to plib makes it unneeded. This...
[flightgear.git] / src / Main / main.cxx
index beab15df0097ddf5a89b43213e21417324561318..dc8c5a8da3b577598fa6c598c5d384bf8bd8671d 100644 (file)
@@ -64,7 +64,6 @@
 
 #include <Include/general.hxx>
 #include <Scenery/tileentry.hxx>
-#include <Time/FGEventMgr.hxx>
 #include <Time/light.hxx>
 #include <Time/light.hxx>
 #include <Aircraft/aircraft.hxx>
@@ -133,8 +132,6 @@ bool glPointParameterIsSupported = false;
 #  include <console.h>         // -dw- for command line dialog
 #endif
 
-FGEventMgr global_events;
-
 // This is a record containing a bit of global housekeeping information
 FGGeneral general;
 
@@ -340,7 +337,7 @@ void trRenderFrame( void ) {
 
     // we need a white diffuse light for the phase of the moon
     ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, white );
-    thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
+    thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER, fog_exp2_density );
 
     // draw the ssg scene
     // return to the desired diffuse color
@@ -374,9 +371,6 @@ void fgRenderFrame() {
     GLfloat black[4] = { 0.0, 0.0, 0.0, 1.0 };
     GLfloat white[4] = { 1.0, 1.0, 1.0, 1.0 };
 
-    // Process/manage pending events
-    global_events.update( delta_time_sec );
-
     // static const SGPropertyNode *longitude
     //     = fgGetNode("/position/longitude-deg");
     // static const SGPropertyNode *latitude
@@ -510,18 +504,18 @@ void fgRenderFrame() {
         if ( skyblend ) {
             /*
              SG_LOG( SG_GENERAL, SG_BULK, "thesky->repaint() sky_color = "
-             << cur_light_params.sky_color[0] << " "
-             << cur_light_params.sky_color[1] << " "
-             << cur_light_params.sky_color[2] << " "
-             << cur_light_params.sky_color[3] );
+             << l->sky_color()[0] << " "
+             << l->sky_color()[1] << " "
+             << l->sky_color()[2] << " "
+             << l->sky_color()[3] );
             SG_LOG( SG_GENERAL, SG_BULK, "    fog = "
-             << cur_light_params.fog_color[0] << " "
-             << cur_light_params.fog_color[1] << " "
-             << cur_light_params.fog_color[2] << " "
-             << cur_light_params.fog_color[3] ); 
+             << l->fog_color()[0] << " "
+             << l->fog_color()[1] << " "
+             << l->fog_color()[2] << " "
+             << l->fog_color()[3] ); 
             SG_LOG( SG_GENERAL, SG_BULK,
-                    "    sun_angle = " << cur_light_params.sun_angle
-             << "    moon_angle = " << cur_light_params.moon_angle );
+                    "    sun_angle = " << l->sun_angle
+             << "    moon_angle = " << l->moon_angle );
             */
 
             static SGSkyColor scolor;
@@ -549,7 +543,7 @@ void fgRenderFrame() {
              << " lon = " << cur_fdm_state->get_Longitude()
              << " lat = " << cur_fdm_state->get_Latitude() );
             SG_LOG( SG_GENERAL, SG_BULK,
-                    "    sun_rot = " << cur_light_params.sun_rotation
+                    "    sun_rot = " << l->get_sun_rotation
              << " gst = " << SGTime::cur_time_params->getGst() );
             SG_LOG( SG_GENERAL, SG_BULK,
                  "    sun ra = " << globals->get_ephem()->getSunRightAscension()
@@ -676,16 +670,10 @@ void fgRenderFrame() {
             // we need a white diffuse light for the phase of the moon
             ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, white );
 
-            thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER );
+            thesky->preDraw( cur_fdm_state->get_Altitude() * SG_FEET_TO_METER, fog_exp2_density );
 
             // return to the desired diffuse color
             ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, l->scene_diffuse() );
-
-            // FIXME: This should not be needed, but at this time (08/15/2003)
-            //        certain NVidia drivers don't seem to implement
-            //        fgPushAttrib(FG_FOG_BIT) properly. The result is that
-            //        there is not fog when looking at the sun.
-            glFogf ( GL_FOG_DENSITY, fog_exp2_density );
         }
 
         // draw the ssg scene
@@ -1025,7 +1013,7 @@ static void fgMainLoop( void ) {
 
     SGTime *t = globals->get_time_params();
 
-    sglog().setLogLevels( SG_ALL, (sgDebugPriority)fgGetInt("/sim/log-level") );
+    globals->get_event_mgr()->update(delta_time_sec);
 
     SGLocation * acmodel_location = 0;
     if(cur_fdm_state->getACModel() != 0) {
@@ -1103,6 +1091,11 @@ static void fgMainLoop( void ) {
                cur_time_override->getLongValue(),
                globals->get_warp() );
 
+    if (globals->get_warp_delta() != 0) {
+       FGLight *l = (FGLight *)(globals->get_subsystem("lighting"));
+       l->update( 0.5 );
+    }
+
     // update magvar model
     globals->get_mag()->update( longitude->getDoubleValue()
                               * SGD_DEGREES_TO_RADIANS,
@@ -1254,10 +1247,11 @@ static void fgMainLoop( void ) {
     // END Tile Manager udpates
 
     if (fgGetBool("/sim/rendering/specular-highlight")) {
-        glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);        glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
+        glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
+       // glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
     } else {
         glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SINGLE_COLOR);
-         glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
+        // glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
     }
 
     // redraw display
@@ -1556,7 +1550,7 @@ bool fgMainInit( int argc, char **argv ) {
     fgInitFGRoot(argc, argv);
 
     // Check for the correct base package version
-    static char required_version[] = "0.9.2";
+    static char required_version[] = "0.9.3";
     string base_version = fgBasePackageVersion();
     if ( !(base_version == required_version) ) {
         // tell the operator how to use this application