Make the max. opacity of a 2d cloud settable

This commit is contained in:
Torsten Dreyer
2010-12-09 09:06:40 +01:00
parent 0909722bb5
commit ab3612517f
2 changed files with 15 additions and 3 deletions

View File

@@ -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 <simgear_config.h>
@@ -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

View File

@@ -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;