#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>
#include <Autopilot/newauto.hxx>
#include <Cockpit/cockpit.hxx>
#include <Cockpit/radiostack.hxx>
+#include <Cockpit/steam.hxx>
#include <Cockpit/panel.hxx>
#include <Cockpit/panel_io.hxx>
#include <FDM/ADA.hxx>
#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>
#include <Time/moonpos.hxx>
#include <Time/tmp.hxx>
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
# include <WeatherCM/FGLocalWeatherDatabase.h>
#else
# include <Environment/environment_mgr.hxx>
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 ) {
return true;
}
+
void fgSetPosFromGlideSlope(void) {
double gs = fgGetDouble("/velocities/glideslope");
double od = fgGetDouble("/sim/startup/offset-distance");
cur_fdm_state = new FGUFO( dt );
} else if ( model == "external" ) {
cur_fdm_state = new FGExternal( dt );
- } else if ( model.find("network,") == 0 ) {
+ } else if ( model.find("network") == 0 ) {
string host = "localhost";
int port1 = 5501;
int port2 = 5502;
}
}
+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() {
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");
+
}
exit(-1);
}
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the event manager subsystem.
+ ////////////////////////////////////////////////////////////////////
+
+ global_events.init();
+
+ // Output event stats every 60 seconds
+ global_events.Register( "FGEventMgr::print_stats()",
+ &global_events, &FGEventMgr::print_stats,
+ 60000 );
+
////////////////////////////////////////////////////////////////////
// Initialize the scenery management subsystem.
////////////////////////////////////////////////////////////////////
- scenery.init();
- scenery.bind();
-
if ( global_tile_mgr.init() ) {
// Load the local scenery data
double visibility_meters = fgGetDouble("/environment/visibility-m");
exit(-1);
}
+ // cause refresh of viewer scenery timestamps every 15 seconds...
+ global_events.Register( "FGTileMgr::refresh_view_timestamps()",
+ &global_tile_mgr, &FGTileMgr::refresh_view_timestamps,
+ 15000 );
+
SG_LOG( SG_GENERAL, SG_DEBUG,
"Current terrain elevation after tile mgr init " <<
- scenery.get_cur_elev() );
+ globals->get_scenery()->get_cur_elev() );
////////////////////////////////////////////////////////////////////
fgInitView();
- ////////////////////////////////////////////////////////////////////
- // Initialize the event manager subsystem.
- ////////////////////////////////////////////////////////////////////
-
- global_events.init();
-
- // Output event stats every 60 seconds
- global_events.Register( "FGEventMgr::print_stats()",
- &global_events, &FGEventMgr::print_stats,
- 60000 );
-
-
////////////////////////////////////////////////////////////////////
// Initialize the lighting subsystem.
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
// Initialize the weather modeling subsystem
-#ifndef FG_NEW_ENVIRONMENT
+#ifdef FG_WEATHERCM
// Initialize the WeatherDatabase
SG_LOG(SG_GENERAL, SG_INFO, "Creating LocalWeatherDatabase");
sgVec3 position;
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
////////////////////////////////////////////////////////////////////
#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.
////////////////////////////////////////////////////////////////////
// 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",
globals->get_controls()->bind();
+ ////////////////////////////////////////////////////////////////////
+ // Initialize the steam subsystem.
+ ////////////////////////////////////////////////////////////////////
+
+ globals->get_steam()->init();
+ globals->get_steam()->bind();
+
+
////////////////////////////////////////////////////////////////////
// Initialize the input subsystem.
////////////////////////////////////////////////////////////////////
= fgGetNode("/sim/freeze/master");
SG_LOG( SG_GENERAL, SG_INFO,
- "/position/altitude = " << altitude->getDoubleValue() );
+ "fgReInitSubsystems(): /position/altitude = "
+ << altitude->getDoubleValue() );
bool freeze = master_freeze->getBoolValue();
if ( !freeze ) {
}
// Initialize the Scenery Management subsystem
- scenery.init();
-
-#if 0
- if( global_tile_mgr.init() ) {
- Load the local scenery data
- global_tile_mgr.update( longitude->getDoubleValue(),
- latitude->getDoubleValue() );
- } else {
- SG_LOG( SG_GENERAL, SG_ALERT, "Error in Tile Manager initialization!" );
- exit(-1);
- }
-#endif
+ // FIXME, what really needs to get initialized here, at the time
+ // this was commented out, scenery.init() was a noop
+ // scenery.init();
fgInitFDM();