]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_init.cxx
Added static port system and a new altimeter model connected to it.
[flightgear.git] / src / Main / fg_init.cxx
index 2a2c999989129035e9fa671e97235b43904a2c51..b5c3f1afe35d28129909201e2a5af0535e02e161 100644 (file)
@@ -63,6 +63,8 @@
 #include <simgear/math/polar3d.hxx>
 #include <simgear/math/sg_geodesy.hxx>
 #include <simgear/misc/sg_path.hxx>
+#include <simgear/sky/clouds3d/SkySceneLoader.hpp>
+#include <simgear/sky/clouds3d/SkyUtil.hpp>
 #include <simgear/timing/sg_time.hxx>
 #include <simgear/timing/lowleveltime.h>
 
@@ -95,6 +97,7 @@
 #include <FDM/YASim/YASim.hxx>
 #include <Include/general.hxx>
 #include <Input/input.hxx>
+#include <Instrumentation/instrument_mgr.hxx>
 // #include <Joystick/joystick.hxx>
 #include <Objects/matlib.hxx>
 #include <Model/acmodel.hxx>
 #include <Scenery/tilemgr.hxx>
 #include <Sound/fg_fx.hxx>
 #include <Sound/soundmgr.hxx>
+#include <Systems/system_mgr.hxx>
 #include <Time/FGEventMgr.hxx>
 #include <Time/light.hxx>
 #include <Time/sunpos.hxx>
@@ -135,6 +139,7 @@ SG_USING_STD(string);
 
 extern const char *default_root;
 
+SkySceneLoader *sgCloud3d;
 
 // Read in configuration (file and command line) and just set fg_root
 bool fgInitFGRoot ( int argc, char **argv ) {
@@ -642,6 +647,15 @@ void fgInitFDM() {
     }
 }
 
+static void printMat(const sgVec4 *mat, char *name="")
+{
+    int i;
+    cout << name << endl;
+    for(i=0; i<4; i++) {
+        cout <<"  "<<mat[i][0]<<" "<<mat[i][1]<<" "<<mat[i][2]<<" "<<mat[i][3]<<endl;
+    }
+    cout << endl;
+}
 
 // Initialize view parameters
 void fgInitView() {
@@ -649,6 +663,11 @@ void fgInitView() {
   globals->get_aircraft_model()->update(0);
   // run update for current view so that data is current...
   globals->get_viewmgr()->update(0);
+
+  printMat(globals->get_current_view()->get_VIEW(),"VIEW");
+  printMat(globals->get_current_view()->get_UP(),"UP");
+  // printMat(globals->get_current_view()->get_LOCAL(),"LOCAL");
+  
 }
 
 
@@ -890,6 +909,20 @@ bool fgInitSubsystems( void ) {
     globals->get_environment_mgr()->bind();
 #endif
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the 3D cloud subsystem.
+    ////////////////////////////////////////////////////////////////////
+    if ( fgGetBool("/sim/rendering/clouds3d") ) {
+        SGPath cloud_path(globals->get_fg_root());
+        cloud_path.append("large.sky");
+        SG_LOG(SG_GENERAL, SG_INFO, "Loading CLOUDS3d from: " << cloud_path.c_str());
+        if ( !sgCloud3d->Load( cloud_path.str() ) ) {
+            fgSetBool("/sim/rendering/clouds3d", false);
+            SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d FAILED: ");
+        }
+        SG_LOG(SG_GENERAL, SG_INFO, "CLOUDS3d Loaded: ");
+    }
+
     ////////////////////////////////////////////////////////////////////
     // Initialize vor/ndb/ils/fix list management and query systems
     ////////////////////////////////////////////////////////////////////
@@ -987,6 +1020,18 @@ bool fgInitSubsystems( void ) {
 
 #endif
 
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the aircraft systems.
+    ////////////////////////////////////////////////////////////////////
+    globals->get_systemmgr()->init();
+    globals->get_systemmgr()->bind();
+
+    ////////////////////////////////////////////////////////////////////
+    // Initialize the instrumentation.
+    ////////////////////////////////////////////////////////////////////
+    globals->get_instrumentmgr()->init();
+    globals->get_instrumentmgr()->bind();
+
     ////////////////////////////////////////////////////////////////////
     // Initialize the radio stack subsystem.
     ////////////////////////////////////////////////////////////////////
@@ -1029,9 +1074,8 @@ bool fgInitSubsystems( void ) {
     // Initialize I/O subsystem.
     ////////////////////////////////////////////////////////////////////
 
-#if ! defined( macintosh )
-    fgIOInit();
-#endif
+    globals->get_io()->init();
+    globals->get_io()->bind();
 
     // Initialize the 2D panel.
     string panel_path = fgGetString("/sim/panel/path",