From: Torsten Dreyer Date: Thu, 9 Dec 2010 08:06:40 +0000 (+0100) Subject: Make the max. opacity of a 2d cloud settable X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ab3612517fd83c1199a5dbeeee138a18fc788732;p=simgear.git Make the max. opacity of a 2d cloud settable --- diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index aa5e44c0..5c62bd05 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -18,7 +18,6 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // -// $Id$ #ifdef HAVE_CONFIG_H # include @@ -152,7 +151,9 @@ SGCloudLayer::SGCloudLayer( const string &tex_path ) : layer_coverage(SG_CLOUD_CLEAR), scale(4000.0), speed(0.0), - direction(0.0) + direction(0.0), + last_course(0.0), + max_alpha(1.0) { // XXX // Render bottoms before the rest of transparent objects (rendered diff --git a/simgear/scene/sky/cloud.hxx b/simgear/scene/sky/cloud.hxx index 75356450..fa65a6ad 100644 --- a/simgear/scene/sky/cloud.hxx +++ b/simgear/scene/sky/cloud.hxx @@ -184,10 +184,20 @@ public: */ inline void setAlpha( float alpha ) { if ( alpha < 0.0 ) { alpha = 0.0; } - if ( alpha > 1.0 ) { alpha = 1.0; } + if ( alpha > max_alpha ) { alpha = max_alpha; } cloud_alpha = alpha; } + inline void setMaxAlpha( float alpha ) { + if ( alpha < 0.0 ) { alpha = 0.0; } + if ( alpha > 1.0 ) { alpha = 1.0; } + max_alpha = alpha; + } + + inline float getMaxAlpha() const { + return max_alpha; + } + /** build the cloud object */ void rebuild(); @@ -257,6 +267,7 @@ private: // double xoff, yoff; SGGeod last_pos; double last_course; + double max_alpha; osg::Vec2 base;