ColorMask
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_COLORMASK
#define OSG_COLORMASK 1
#include <osg/Export>
#include <osg/StateAttribute>
namespace osg {
class OSG_EXPORT ColorMask : public StateAttribute
{
public :
ColorMask();
ColorMask(bool red,bool green,bool blue,bool alpha):
_red(red),
_green(green),
_blue(blue),
_alpha(alpha) {}
ColorMask(const ColorMask& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(cm,copyop),
_red(cm._red),
_green(cm._green),
_blue(cm._blue),
_alpha(cm._alpha) {}
META_StateAttribute(osg, ColorMask, COLORMASK);
virtual int compare(const StateAttribute& sa) const
{
// Check for equal types, then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(ColorMask,sa)
// Compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_red)
COMPARE_StateAttribute_Parameter(_green)
COMPARE_StateAttribute_Parameter(_blue)
COMPARE_StateAttribute_Parameter(_alpha)
return 0; // Passed all the above comparison macros, so must be equal.
}
inline void setMask(bool red,bool green,bool blue,bool alpha)
{
_red = red;
_green = green;
_blue = blue;
_alpha = alpha;
}
inline void setRedMask(bool mask) { _red=mask; }
inline bool getRedMask() const { return _red; }
inline void setGreenMask(bool mask) { _green=mask; }
inline bool getGreenMask() const { return _green; }
inline void setBlueMask(bool mask) { _blue=mask; }
inline bool getBlueMask() const { return _blue; }
inline void setAlphaMask(bool mask) { _alpha=mask; }
inline bool getAlphaMask() const { return _alpha; }
virtual void apply(State& state) const;
protected:
virtual ~ColorMask();
bool _red;
bool _green;
bool _blue;
bool _alpha;
};
}
#endif
StateAttribute
COMPARE_StateAttribute_Parameter
#define COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
COMPARE_StateAttribute_Types
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
osg::ColorMask::_blue
bool _blue
Definition ColorMask:93
osg::ColorMask::ColorMask
ColorMask(const ColorMask &cm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition ColorMask:39
osg::ColorMask::getGreenMask
bool getGreenMask() const
Definition ColorMask:77
osg::ColorMask::ColorMask
ColorMask(bool red, bool green, bool blue, bool alpha)
Definition ColorMask:31
osg::ColorMask::setGreenMask
void setGreenMask(bool mask)
Definition ColorMask:76
osg::ColorMask::getAlphaMask
bool getAlphaMask() const
Definition ColorMask:83
osg::ColorMask::_red
bool _red
Definition ColorMask:91
osg::ColorMask::_alpha
bool _alpha
Definition ColorMask:94
osg::ColorMask::setRedMask
void setRedMask(bool mask)
Definition ColorMask:73
osg::ColorMask::_green
bool _green
Definition ColorMask:92
osg::ColorMask::setBlueMask
void setBlueMask(bool mask)
Definition ColorMask:79
osg::ColorMask::getBlueMask
bool getBlueMask() const
Definition ColorMask:80
osg::ColorMask::ColorMask
ColorMask()
osg::ColorMask::apply
virtual void apply(State &state) const
osg::ColorMask::~ColorMask
virtual ~ColorMask()
osg::ColorMask::setAlphaMask
void setAlphaMask(bool mask)
Definition ColorMask:82
osg::ColorMask::setMask
void setMask(bool red, bool green, bool blue, bool alpha)
Definition ColorMask:64
osg::ColorMask::META_StateAttribute
META_StateAttribute(osg, ColorMask, COLORMASK)
osg::ColorMask::getRedMask
bool getRedMask() const
Definition ColorMask:74
osg::ColorMask::compare
virtual int compare(const StateAttribute &sa) const
Definition ColorMask:49
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::COLORMASK
@ COLORMASK
Definition StateAttribute:153
osg::State
Definition State:80
osg
Definition AlphaFunc:19
Export
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39