X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FEnvironment%2Fenvironment_mgr.cxx;h=acf20b861ed86f18059c2991cf8401dc874b84a6;hb=386aefe69358ce41a11c9afeb8f56e26758fe56b;hp=7b4f91e1fe6b208932a60346d1476b61e8e94878;hpb=7e3531ef5cae0c0e9ac325de8712f3b67a3e5e5f;p=flightgear.git diff --git a/src/Environment/environment_mgr.cxx b/src/Environment/environment_mgr.cxx index 7b4f91e1f..acf20b861 100644 --- a/src/Environment/environment_mgr.cxx +++ b/src/Environment/environment_mgr.cxx @@ -36,8 +36,8 @@ #include #include "environment.hxx" -#include "environment_ctrl.hxx" #include "environment_mgr.hxx" +#include "environment_ctrl.hxx" #include "fgclouds.hxx" #include "precipitation_mgr.hxx" @@ -50,26 +50,39 @@ FGEnvironmentMgr::FGEnvironmentMgr () : _environment(new FGEnvironment) { - if (fgGetBool("/environment/params/real-world-weather-fetch") == true) - _controller = new FGMetarEnvironmentCtrl; - else - _controller = new FGInterpolateEnvironmentCtrl; - + _controller = new FGInterpolateEnvironmentCtrl; _controller->setEnvironment(_environment); - set_subsystem("controller", _controller, 0.5); - fgClouds = new FGClouds( _controller ); + set_subsystem("controller", _controller, 0.1 ); + + fgClouds = new FGClouds(); + + _metarcontroller = new FGMetarCtrl(_controller ); + set_subsystem("metarcontroller", _metarcontroller, 0.1 ); + + _metarfetcher = new FGMetarFetcher(); + set_subsystem("metarfetcher", _metarfetcher, 1.0 ); + _precipitationManager = new FGPrecipitationMgr; set_subsystem("precipitation", _precipitationManager); } FGEnvironmentMgr::~FGEnvironmentMgr () { - delete _environment; - remove_subsystem("controller"); remove_subsystem("precipitation"); - delete _controller; - delete fgClouds; delete _precipitationManager; + + remove_subsystem("metarcontroller"); + delete _metarfetcher; + + remove_subsystem("metarfetcher"); + delete _metarcontroller; + + delete fgClouds; + + remove_subsystem("controller"); + delete _controller; + + delete _environment; } void @@ -91,6 +104,7 @@ FGEnvironmentMgr::reinit () void FGEnvironmentMgr::bind () { + SGSubsystemGroup::bind(); fgTie("/environment/visibility-m", _environment, &FGEnvironment::get_visibility_m, &FGEnvironment::set_visibility_m); fgSetArchivable("/environment/visibility-m"); @@ -152,9 +166,12 @@ FGEnvironmentMgr::bind () fgSetArchivable("/environment/thermal-lift-fps"); fgTie("/environment/ridge-lift-fps", _environment, &FGEnvironment::get_ridge_lift_fps, - &FGEnvironment::set_ridge_lift_fps); + &FGEnvironment::set_ridge_lift_fps); fgSetArchivable("/environment/ridge-lift-fps"); - + + fgTie("/environment/local-weather-lift", _environment, + &FGEnvironment::get_local_weather_lift_fps); //read-only + fgTie("/environment/turbulence/magnitude-norm", _environment, &FGEnvironment::get_turbulence_magnitude_norm, &FGEnvironment::set_turbulence_magnitude_norm); @@ -192,6 +209,10 @@ FGEnvironmentMgr::bind () &FGEnvironmentMgr::set_cloud_layer_coverage); fgSetArchivable(buf); } + + fgTie("/environment/metar/data", _metarcontroller, + &FGMetarCtrl::get_metar, &FGMetarCtrl::set_metar ); + fgTie("/sim/rendering/clouds3d-enable", fgClouds, &FGClouds::get_3dClouds, &FGClouds::set_3dClouds); @@ -208,9 +229,6 @@ FGEnvironmentMgr::bind () fgTie("/environment/rebuild-layers", fgClouds, &FGClouds::get_update_event, &FGClouds::set_update_event); - fgTie("/environment/weather-scenario", fgClouds, - &FGClouds::get_scenario, - &FGClouds::set_scenario); fgTie("/sim/rendering/lightning-enable", &sgEnviro, &SGEnviro::get_lightning_enable_state, &SGEnviro::set_lightning_enable_state); @@ -240,6 +258,7 @@ FGEnvironmentMgr::unbind () fgUntie("/environment/thermal-lift-fps"); fgUntie("/environment/ridge-lift-fps"); + fgUntie("/environment/local-weather-lift"); fgUntie("/environment/atmosphere/altitude-half-to-sun"); fgUntie("/environment/atmosphere/altitude-troposphere-top"); @@ -264,6 +283,7 @@ FGEnvironmentMgr::unbind () fgUntie("/environment/weather-scenario"); fgUntie("/sim/rendering/lightning-enable"); fgUntie("/environment/turbulence/use-cloud-turbulence"); + SGSubsystemGroup::unbind(); } void @@ -277,6 +297,7 @@ FGEnvironmentMgr::update (double dt) _environment->get_wind_from_east_fps(), _environment->get_wind_from_down_fps()); _environment->set_elevation_ft(fgGetDouble("/position/altitude-ft")); + _environment->set_local_weather_lift_fps(fgGetDouble("/local-weather/current/thermal-lift")); osg::Vec3 windVec(-_environment->get_wind_from_north_fps(), -_environment->get_wind_from_east_fps(), _environment->get_wind_from_down_fps());