#include <simgear/math/SGMath.hxx>
#include <simgear/scene/sky/sky.hxx>
#include <simgear/scene/sky/cloud.hxx>
-#include <simgear/environment/visual_enviro.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
+#include <Main/renderer.hxx>
#include <Scenery/scenery.hxx>
#include "precipitation_mgr.hxx"
-extern SGSky *thesky;
-
-
/**
* @brief FGPrecipitation Manager constructor
*
fgGetNode("environment/params/precipitation-level-ft", true);
}
+void FGPrecipitationMgr::bind ()
+{
+ _tiedProperties.setRoot( fgGetNode("/sim/rendering", true ) );
+ _tiedProperties.Tie("precipitation-enable", precipitation.get(),
+ &SGPrecipitation::getEnabled,
+ &SGPrecipitation::setEnabled);
+}
+
+void FGPrecipitationMgr::unbind ()
+{
+ _tiedProperties.Untie();
+}
+
void FGPrecipitationMgr::setPrecipitationLevel(double a)
{
fgSetDouble("environment/params/precipitation-level-ft",a);
max = SGCloudLayer::SG_MAX_CLOUD_COVERAGES;
result = 0;
+ SGSky* thesky = globals->get_renderer()->getSky();
+
// To avoid messing up
if (thesky == NULL)
return result;
setPrecipitationLevel(altitudeCloudLayer);
// Does the user enable the precipitation ?
- if (!sgEnviro.get_precipitation_enable_state()) {
+ if (!precipitation->getEnabled() ) {
// Disable precipitations
precipitation->setRainIntensity(0);
precipitation->setSnowIntensity(0);