]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/main.cxx
- adjusted for no-value constructor for FGPanel
[flightgear.git] / src / Main / main.cxx
index 81dd78176115b76afc36260059f846dfc815bc53..cfb2a382b8ee87951004f1eec5a9192f3df702d8 100644 (file)
 #  include <unistd.h>          // for stat()
 #endif
 
+// #ifdef HAVE_LIBX11
+// #  include <GL/glext.h>
+// #endif
+
 #include <plib/pu.h>
 #include <plib/ssg.h>
 
@@ -77,7 +81,7 @@
 #include <FDM/UIUCModel/uiuc_aircraftdir.h>
 #include <GUI/gui.h>
 #include <GUI/sgVec3Slider.hxx>
-#include <Joystick/joystick.hxx>
+// #include <Joystick/joystick.hxx>
 #ifdef FG_NETWORK_OLK
 #include <NetworkOLK/network.h>
 #endif
@@ -94,6 +98,8 @@
 #include <Time/sunpos.hxx>
 #include <Time/tmp.hxx>
 
+#include <Input/input.hxx>
+
 // begin - added Venky
 //    $$$ begin - added VS Renganathan
 #include <simgear/misc/sgstream.hxx>
@@ -117,11 +123,10 @@ int objc=0;
 
 #include "version.h"
 
-#include "bfi.hxx"
 #include "fg_init.hxx"
 #include "fg_io.hxx"
+#include "fg_props.hxx"
 #include "globals.hxx"
-#include "keyboard.hxx"
 #include "splash.hxx"
 
 #ifdef macintosh
@@ -308,8 +313,8 @@ void fgInitVisuals( void ) {
 
 // Update all Visuals (redraws anything graphics related)
 void fgRenderFrame( void ) {
-    // Update the BFI.
-    FGBFI::update();
+    // Update the default (kludged) properties.
+    fgUpdateProps();
 
     fgLIGHT *l = &cur_light_params;
     static double last_visibility = -9999;
@@ -640,9 +645,10 @@ void fgRenderFrame( void ) {
 
            if (prop_selector != NULL) {
              int propsel_mask = 0;
+             double rpm = fgGetDouble("/engines/engine0/rpm");
              for (int i = 0; i < acmodel_npropsettings; i++) {
-               if (FGBFI::getRPM() >= acmodel_proprpms[i][0] &&
-                   FGBFI::getRPM() <= acmodel_proprpms[i][1]) {
+               if (rpm >= acmodel_proprpms[i][0] &&
+                   rpm <= acmodel_proprpms[i][1]) {
                  propsel_mask |= 1 << i;
                }
              }
@@ -713,6 +719,9 @@ void fgRenderFrame( void ) {
        // glDisable( GL_CULL_FACE );
        // glDisable( GL_TEXTURE_2D );
 
+       // update the input subsystem
+       current_input.update();
+
        // update the controls subsystem
        controls.update();
 
@@ -897,10 +906,10 @@ static void fgMainLoop( void ) {
 
 #if defined( ENABLE_PLIB_JOYSTICK )
     // Read joystick and update control settings
-    if ( fgGetString("/sim/control-mode") == "joystick" )
-    {
-       fgJoystickRead();
-    }
+    // if ( fgGetString("/sim/control-mode") == "joystick" )
+    // {
+    //    fgJoystickRead();
+    // }
 #elif defined( ENABLE_GLUT_JOYSTICK )
     // Glut joystick support works by feeding a joystick handler
     // function to glut.  This is taken care of once in the joystick
@@ -1338,8 +1347,10 @@ int fgGlutInitEvents( void ) {
     glutReshapeFunc( fgReshape );
 
     // call GLUTkey() on keyboard event
-    glutKeyboardFunc( GLUTkey );
-    glutSpecialFunc( GLUTspecialkey );
+    glutKeyboardFunc(GLUTkey);
+    glutKeyboardUpFunc(GLUTkeyup);
+    glutSpecialFunc(GLUTspecialkey);
+    glutSpecialUpFunc(GLUTspecialkeyup);
 
     // call guiMouseFunc() whenever our little rodent is used
     glutMouseFunc ( guiMouseFunc );
@@ -1385,9 +1396,7 @@ int main( int argc, char **argv ) {
     // Allocate global data structures.  This needs to happen before
     // we parse command line options
 
-    SGPropertyNode *props = new SGPropertyNode;
     globals = new FGGlobals;
-    globals->set_props( props );
 
     // seed the random number generater
     sg_srandom_time();
@@ -1450,6 +1459,20 @@ int main( int argc, char **argv ) {
     // fonts !!!
     guiInit();
 
+#ifdef GL_EXT_texture_lod_bias
+    glTexEnvf( GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, -0.5 ) ;
+#endif
+
+#if 0
+#ifdef GL_EXT_texture_filter_anisotropic
+    float max_anisotropy;
+    glGetFloatv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy );
+    glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT,
+                     max_anisotropy );
+    cout << "Max anisotropy = " << max_anisotropy << endl;
+#endif
+#endif
+
     // set current_options lon/lat if an airport id is specified
     // cout << "3. airport_id = " << fgGetString("/sim/startup/airport-id") << endl;
     if ( fgGetString("/sim/startup/airport-id").length() ) {
@@ -1543,12 +1566,12 @@ int main( int argc, char **argv ) {
                   globals->get_ephem()->getStars(), 60000.0 );
 
     if ( fgGetBool("/environment/clouds/status") ) {
-       thesky->add_cloud_layer( 2000.0, 200.0, 50.0, 40000.0,
-                                SG_CLOUD_OVERCAST );
+       // thesky->add_cloud_layer( 2000.0, 200.0, 50.0, 40000.0,
+        //                          SG_CLOUD_OVERCAST );
        thesky->add_cloud_layer( 2600.0, 200.0, 50.0, 40000.0,
                                 SG_CLOUD_MOSTLY_CLOUDY );
-       thesky->add_cloud_layer( 3000.0, 200.0, 50.0, 40000.0,
-                                SG_CLOUD_MOSTLY_SUNNY );
+       // thesky->add_cloud_layer( 3000.0, 200.0, 50.0, 40000.0,
+       //                          SG_CLOUD_MOSTLY_SUNNY );
        thesky->add_cloud_layer( 6000.0, 20.0, 10.0, 40000.0,
                                 SG_CLOUD_CIRRUS );
     }
@@ -1585,15 +1608,14 @@ int main( int argc, char **argv ) {
 
 #if !defined( PLIB_1_2_X )
     // this should be redundant ... but it breaks for relative paths
-    // w/ plib-1.2.0
-    ssgModelPath( (char *)full_model.dir().c_str() );
+    // ssgModelPath( (char *)full_model.dir().c_str() );
 #endif
 
     ssgTexturePath( (char *)full_model.dir().c_str() );
     ssgEntity *acmodel_obj = ssgLoad( (char *)full_model.c_str() );
     if( !acmodel_obj ) {
         // fall back to default
-        acmodel_obj = ssgLoad( (char *)"glider.ac" );
+        acmodel_obj = ssgLoad( (char *)"Models/Geometry/glider.ac" );
         if( !acmodel_obj ) {
             SG_LOG( SG_GENERAL, SG_ALERT, "FAILED to LOAD an AC model! ..." );
             exit(-1);