]> git.mxchange.org Git - flightgear.git/blobdiff - src/Environment/environment_mgr.cxx
Stuart :
[flightgear.git] / src / Environment / environment_mgr.cxx
index 5440ba253b87a4d194e0e5b10fe6551285062624..4542472d8881c441193b8619255c2eecc593ad96 100644 (file)
 #  include <config.h>
 #endif
 
+#include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 #include <simgear/scene/sky/sky.hxx>
 #include <simgear/environment/visual_enviro.hxx>
+#include <simgear/scene/model/particles.hxx>
 
 #include <Main/main.hxx>
 #include <Main/fg_props.hxx>
@@ -180,23 +182,18 @@ FGEnvironmentMgr::bind ()
          &FGEnvironmentMgr::set_cloud_layer_coverage);
     fgSetArchivable(buf);
   }
-  fgTie("/sim/rendering/clouds3d-enable", &sgEnviro,
-         &SGEnviro::get_clouds_enable_state,
-         &SGEnviro::set_clouds_enable_state);
-  fgTie("/sim/rendering/clouds3d-vis-range", &sgEnviro,
-         &SGEnviro::get_clouds_visibility,
-         &SGEnviro::set_clouds_visibility);
-  fgTie("/sim/rendering/clouds3d-density", &sgEnviro,
-         &SGEnviro::get_clouds_density,
-         &SGEnviro::set_clouds_density);
-  fgTie("/sim/rendering/clouds3d-cache-size", &sgEnviro,
-         &SGEnviro::get_clouds_CacheSize,
-         &SGEnviro::set_clouds_CacheSize);
-  fgTie("/sim/rendering/clouds3d-cache-resolution", &sgEnviro,
-         &SGEnviro::get_CacheResolution,
-         &SGEnviro::set_CacheResolution);
+  fgTie("/sim/rendering/clouds3d-enable", fgClouds,
+         &FGClouds::get_3dClouds,
+         &FGClouds::set_3dClouds);
+  fgTie("/sim/rendering/clouds3d-density", thesky,
+         &SGSky::get_3dCloudDensity,
+         &SGSky::set_3dCloudDensity);
+  fgTie("/sim/rendering/clouds3d-vis-range", thesky,
+        &SGSky::get_3dCloudVisRange,
+        &SGSky::set_3dCloudVisRange);
+  
   fgTie("/sim/rendering/precipitation-enable", &sgEnviro,
-         &SGEnviro::get_precipitation_enable_state,
+         &SGEnviro::get_precipitation_enable_state, 
          &SGEnviro::set_precipitation_enable_state);
   fgTie("/environment/rebuild-layers", fgClouds,
       &FGClouds::get_update_event,
@@ -245,8 +242,6 @@ FGEnvironmentMgr::unbind ()
   fgUntie("/sim/rendering/clouds3d-enable");
   fgUntie("/sim/rendering/clouds3d-vis-range");
   fgUntie("/sim/rendering/clouds3d-density");
-  fgUntie("/sim/rendering/clouds3d-cache-size");
-  fgUntie("/sim/rendering/clouds3d-cache-resolution");
   fgUntie("/sim/rendering/precipitation-enable");
   fgUntie("/environment/rebuild-layers");
   fgUntie("/sim/rendering/lightning-enable");
@@ -264,6 +259,10 @@ FGEnvironmentMgr::update (double dt)
                                   _environment->get_wind_from_east_fps(),
                                   _environment->get_wind_from_down_fps());
   _environment->set_elevation_ft(fgGetDouble("/position/altitude-ft"));
+  osg::Vec3 windVec(-_environment->get_wind_from_north_fps(),
+                    -_environment->get_wind_from_east_fps(),
+                    _environment->get_wind_from_down_fps());
+  simgear::Particles::setWindVector(windVec * SG_FEET_TO_METER);
 
   _update_fdm();
 }
@@ -285,6 +284,18 @@ FGEnvironmentMgr::getEnvironment (double lat, double lon, double alt) const
   return env;
 }
 
+FGEnvironment
+FGEnvironmentMgr::getEnvironment(const SGGeod& aPos) const
+{
+  // Always returns the same environment
+  // for now; we'll make it interesting
+  // later.
+  FGEnvironment env = *_environment;
+  env.set_elevation_ft(aPos.getElevationFt());
+  return env;
+
+}
+
 void
 FGEnvironmentMgr::_update_fdm () const
 {