X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FEnvironment%2Fprecipitation_mgr.cxx;h=9e83ab8529aeff365f7ce50939b5f6dfd17f16ef;hb=06e8fe747fb1733528aa1e01bc6bd285a53ec127;hp=e4ca0c0f638723d3bb367cd1b0d532d6fcdda3b5;hpb=89b41395d861a49ad543af166c0bd41c14dd0d2b;p=flightgear.git diff --git a/src/Environment/precipitation_mgr.cxx b/src/Environment/precipitation_mgr.cxx index e4ca0c0f6..9e83ab852 100644 --- a/src/Environment/precipitation_mgr.cxx +++ b/src/Environment/precipitation_mgr.cxx @@ -59,6 +59,9 @@ FGPrecipitationMgr::FGPrecipitationMgr() // By default, no precipitation precipitation->setRainIntensity(0); precipitation->setSnowIntensity(0); + + // set the clip distance from the config + precipitation->setClipDistance(fgGetFloat("/environment/precipitation-control/clip-distance",5.0)); transform->addChild(precipitation->build()); group->addChild(transform.get()); } @@ -124,7 +127,7 @@ osg::Group * FGPrecipitationMgr::getObject(void) * @returns Elevation max in meter * * This function permits you to know what is the altitude max where we can - * find precipitation. The value is returned in meter. + * find precipitation. The value is returned in meters. */ float FGPrecipitationMgr::getPrecipitationAtAltitudeMax(void) { @@ -132,6 +135,12 @@ float FGPrecipitationMgr::getPrecipitationAtAltitudeMax(void) int max; float result; SGPropertyNode *boundaryNode, *boundaryEntry; + + if (fgGetBool("/environment/params/use-external-precipitation-level", false)) { + // If we're not modeling the precipitation level based on the cloud + // layers, take it directly from the property tree. + return fgGetFloat("/environment/params/external-precipitation-level-m", 0.0); + } // By default (not cloud layer) @@ -212,22 +221,38 @@ void FGPrecipitationMgr::update(double dt) float altitudeAircraft; float altitudeCloudLayer; + float rainDropletSize; + float snowFlakeSize; + float illumination; altitudeCloudLayer = this->getPrecipitationAtAltitudeMax() * SG_METER_TO_FEET; setPrecipitationLevel(altitudeCloudLayer); - // Does the user enable the precipitation ? - if (!precipitation->getEnabled() ) { - // Disable precipitations - precipitation->setRainIntensity(0); - precipitation->setSnowIntensity(0); - // Update the drawing... - precipitation->update(); - // Exit - return; - } + // Does the user enable the precipitation ? + if (!precipitation->getEnabled() ) { + // Disable precipitations + precipitation->setRainIntensity(0); + precipitation->setSnowIntensity(0); + + // Update the drawing... + precipitation->update(); + + // Exit + return; + } + + // See if external droplet size and illumination are used + if (fgGetBool("/environment/precipitation-control/detailed-precipitation", false)) { + precipitation->setDropletExternal(true); + rainDropletSize = fgGetFloat("/environment/precipitation-control/rain-droplet-size", 0.015); + snowFlakeSize = fgGetFloat("/environment/precipitation-control/snow-flake-size", 0.03); + illumination = fgGetFloat("/environment/precipitation-control/illumination", 1.0); + precipitation->setRainDropletSize(rainDropletSize); + precipitation->setSnowFlakeSize(snowFlakeSize); + precipitation->setIllumination(illumination); + } // Get the elevation of aicraft and of the cloud layer altitudeAircraft = fgGetDouble("/position/altitude-ft", 0.0);