#include "precipitation_mgr.hxx"
-
extern SGSky *thesky;
// By default, no precipitation
precipitation->setRainIntensity(0);
precipitation->setSnowIntensity(0);
-
transform->addChild(precipitation->build());
group->addChild(transform.get());
}
// Add to scene graph
osg::Group* scenery = globals->get_scenery()->get_scene_graph();
scenery->addChild(getObject());
+ fgGetNode("environment/params/precipitation-level-ft", true);
+}
+
+void FGPrecipitationMgr::setPrecipitationLevel(double a)
+{
+ fgSetDouble("environment/params/precipitation-level-ft",a);
}
/**
return this->group.get();
}
-
/**
* @brief Calculate the max alitutude with precipitation
*
float altitudeAircraft;
float altitudeCloudLayer;
+ altitudeCloudLayer = this->getPrecipitationAtAltitudeMax() * SG_METER_TO_FEET;
+ setPrecipitationLevel(altitudeCloudLayer);
+
// Does the user enable the precipitation ?
if (!sgEnviro.get_precipitation_enable_state()) {
// Disable precipitations
// Get the elevation of aicraft and of the cloud layer
altitudeAircraft = fgGetDouble("/position/altitude-ft", 0.0);
- altitudeCloudLayer = this->getPrecipitationAtAltitudeMax() * SG_METER_TO_FEET;
if ((altitudeCloudLayer > 0) && (altitudeAircraft > altitudeCloudLayer)) {
// The aircraft is above the cloud layer
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/environment/precipitation.hxx>
+
class FGPrecipitationMgr : public SGSubsystem
{
private:
osg::ref_ptr<SGPrecipitation> precipitation;
float getPrecipitationAtAltitudeMax(void);
-
public:
FGPrecipitationMgr();
virtual ~FGPrecipitationMgr();
virtual void init ();
virtual void update (double dt);
+ void setPrecipitationLevel(double l);
+
osg::Group * getObject(void);
+
};
#endif