1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
15#define OSG_COLORMASKI 1
17#include <osg/ColorMask>
21/** Encapsulates glColorMaski function : the index version of glColorMask for multiple render target.
23class OSG_EXPORT ColorMaski : public ColorMask
29 ColorMaski(unsigned int buf, bool red, bool green, bool blue, bool alpha):
30 ColorMask(red, green,blue,alpha),
33 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
34 ColorMaski(const ColorMaski& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
38 META_StateAttribute(osg, ColorMaski, COLORMASK);
40 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
41 virtual int compare(const StateAttribute& sa) const
43 // Check for equal types, then create the rhs variable
44 // used by the COMPARE_StateAttribute_Parameter macros below.
45 COMPARE_StateAttribute_Types(ColorMaski,sa)
47 COMPARE_StateAttribute_Parameter(_index);
49 return ColorMask::compare(sa);
52 /** Return the buffer index as the member identifier.*/
53 virtual unsigned int getMember() const { return _index; }
55 /** Set the renderbuffer index of the ColorMaski. */
56 void setIndex(unsigned int buf);
58 /** Get the renderbuffer index of the ColorMaski. */
59 unsigned int getIndex() const { return _index; }
61 virtual void apply(State& state) const;
65 virtual ~ColorMaski();