#include <Time/light.hxx>
#include <Time/sunpos.hxx>
#include <Time/moonpos.hxx>
-#include <Weather/weather.hxx>
+// #include <Weather/weather.hxx>
+#include <WeatherCM/FGLocalWeatherDatabase.h>
#include "fg_init.hxx"
#include "options.hxx"
// and should really be read in from one or more files.
// Initial Velocity
- f->set_Velocities_Local( 0.0, 0.0, 0.0 );
+ f->set_Velocities_Local( current_options.get_uBody(),
+ current_options.get_vBody(),
+ current_options.get_wBody());
// Initial Orientation
f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
v->UpdateViewMath(f);
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos());
- v->UpdateWorldToEye(f);
+ // v->UpdateWorldToEye(f);
// Build the solar system
//fgSolarSystemInit(*t);
fgEVENT::FG_EVENT_READY, 30000 );
// Initialize the weather modeling subsystem
- current_weather.Init();
+ // current_weather.Init();
+ // Initialize the WeatherDatabase
+ FG_LOG(FG_GENERAL, FG_INFO, "Creating LocalWeatherDatabase");
+ FGLocalWeatherDatabase::theFGLocalWeatherDatabase =
+ new FGLocalWeatherDatabase(
+ Point3D( current_aircraft.fdm_state->get_Latitude(),
+ current_aircraft.fdm_state->get_Longitude(),
+ current_aircraft.fdm_state->get_Altitude()
+ * FEET_TO_METER) );
+
+ WeatherDatabase = FGLocalWeatherDatabase::theFGLocalWeatherDatabase;
+
+ // register the periodic update of the weather
+ global_events.Register( "weather update", fgUpdateWeatherDatabase,
+ fgEVENT::FG_EVENT_READY, 30000);
// Initialize the Cockpit subsystem
if( fgCockpitInit( ¤t_aircraft )) {
// and should really be read in from one or more files.
// Initial Velocity
- f->set_Velocities_Local( 0.0, 0.0, 0.0 );
+ f->set_Velocities_Local( current_options.get_uBody(),
+ current_options.get_vBody(),
+ current_options.get_wBody());
// Initial Orientation
f->set_Euler_Angles( current_options.get_roll() * DEG_TO_RAD,
FG_LOG( FG_GENERAL, FG_DEBUG, "After v->init()");
v->UpdateViewMath(f);
FG_LOG( FG_GENERAL, FG_DEBUG, " abs_view_pos = " << v->get_abs_view_pos());
- v->UpdateWorldToEye(f);
+ // v->UpdateWorldToEye(f);
fgFDMInit( current_options.get_flight_model(), cur_fdm_state,
1.0 / DEFAULT_MODEL_HZ );