OpenSceneGraph 3.6.5
ColorMask
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
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.
7 *
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.
12*/
13
14#ifndef OSG_COLORMASK
15#define OSG_COLORMASK 1
16
17#include <osg/Export>
18#include <osg/StateAttribute>
19
20namespace osg {
21
25{
26 public :
27
28
30
31 ColorMask(bool red,bool green,bool blue,bool alpha):
32 _red(red),
33 _green(green),
34 _blue(blue),
35 _alpha(alpha) {}
36
37
40 StateAttribute(cm,copyop),
41 _red(cm._red),
42 _green(cm._green),
43 _blue(cm._blue),
44 _alpha(cm._alpha) {}
45
47
49 virtual int compare(const StateAttribute& sa) const
50 {
51 // Check for equal types, then create the rhs variable
52 // used by the COMPARE_StateAttribute_Parameter macros below.
54
55 // Compare each parameter in turn against the rhs.
60
61 return 0; // Passed all the above comparison macros, so must be equal.
62 }
63
64 inline void setMask(bool red,bool green,bool blue,bool alpha)
65 {
66 _red = red;
67 _green = green;
68 _blue = blue;
69 _alpha = alpha;
70
71 }
72
73 inline void setRedMask(bool mask) { _red=mask; }
74 inline bool getRedMask() const { return _red; }
75
76 inline void setGreenMask(bool mask) { _green=mask; }
77 inline bool getGreenMask() const { return _green; }
78
79 inline void setBlueMask(bool mask) { _blue=mask; }
80 inline bool getBlueMask() const { return _blue; }
81
82 inline void setAlphaMask(bool mask) { _alpha=mask; }
83 inline bool getAlphaMask() const { return _alpha; }
84
85 virtual void apply(State& state) const;
86
87 protected:
88
89 virtual ~ColorMask();
90
91 bool _red;
92 bool _green;
93 bool _blue;
94 bool _alpha;
95
96};
97
98}
99
100#endif
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
bool _blue
Definition ColorMask:93
ColorMask(const ColorMask &cm, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition ColorMask:39
bool getGreenMask() const
Definition ColorMask:77
ColorMask(bool red, bool green, bool blue, bool alpha)
Definition ColorMask:31
void setGreenMask(bool mask)
Definition ColorMask:76
bool getAlphaMask() const
Definition ColorMask:83
bool _red
Definition ColorMask:91
bool _alpha
Definition ColorMask:94
void setRedMask(bool mask)
Definition ColorMask:73
bool _green
Definition ColorMask:92
void setBlueMask(bool mask)
Definition ColorMask:79
bool getBlueMask() const
Definition ColorMask:80
virtual void apply(State &state) const
apply the OpenGL state attributes.
virtual ~ColorMask()
void setAlphaMask(bool mask)
Definition ColorMask:82
void setMask(bool red, bool green, bool blue, bool alpha)
Definition ColorMask:64
META_StateAttribute(osg, ColorMask, COLORMASK)
bool getRedMask() const
Definition ColorMask:74
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition ColorMask:49
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
@ COLORMASK
Definition StateAttribute:153
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.