Make visibility within cloudlayers settable

This commit is contained in:
Torsten Dreyer
2010-11-26 19:24:44 +01:00
parent 093e4614d3
commit a6138b3445
3 changed files with 27 additions and 4 deletions

View File

@@ -148,6 +148,7 @@ SGCloudLayer::SGCloudLayer( const string &tex_path ) :
layer_asl(0.0),
layer_thickness(0.0),
layer_transition(0.0),
layer_visibility(25.0),
layer_coverage(SG_CLOUD_CLEAR),
scale(4000.0),
speed(0.0),
@@ -260,6 +261,18 @@ SGCloudLayer::setThickness_m (float thickness_m)
layer_thickness = thickness_m;
}
float
SGCloudLayer::getVisibility_m() const
{
return layer_visibility;
}
void
SGCloudLayer::setVisibility_m (float visibility_m)
{
layer_visibility = visibility_m;
}
float
SGCloudLayer::getTransition_m () const
{

View File

@@ -108,6 +108,16 @@ public:
*/
void setThickness_m (float thickness_m);
/** get the layer visibility */
float getVisibility_m() const;
/**
* set the layer visibility
* @param visibility_m the layer minimum visibility in meters.
*/
void setVisibility_m(float visibility_m);
/**
* get the transition/boundary layer depth in meters. This
* allows gradual entry/exit from the cloud layer via adjusting
@@ -235,6 +245,7 @@ private:
float layer_asl;
float layer_thickness;
float layer_transition;
float layer_visibility;
Coverage layer_coverage;
float scale;
float speed;

View File

@@ -31,6 +31,7 @@
#include <simgear/math/sg_random.h>
#include <simgear/scene/util/RenderConstants.hxx>
#include <sg_inlines.h>
#include <osg/StateSet>
#include <osg/Depth>
@@ -359,10 +360,8 @@ void SGSky::modify_vis( float alt, float time_factor ) {
}
#endif
// never let visibility drop below 25 meters
if ( effvis <= 25.0 ) {
effvis = 25.0;
}
// never let visibility drop below the layer's configured visibility
effvis = SG_MAX2<float>(cloud_layers[i]->getVisibility_m(), effvis );
} // for