Equalizer  1.6.1
colorMask.h
1 
2 /* Copyright (c) 2007-2010, Stefan Eilemann <eile@equalizergraphics.com>
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License version 2.1 as published
6  * by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11  * details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 
18 #ifndef EQFABRIC_COLORMASK_H
19 #define EQFABRIC_COLORMASK_H
20 
21 #include <eq/fabric/api.h>
22 #include <iostream>
23 
24 namespace eq
25 {
26 namespace fabric
27 {
33  class ColorMask
34  {
35  public:
37  ColorMask() : red( true ), green( true ), blue( true ), alpha( true ) {}
38 
40  ColorMask( const bool r, const bool g, const bool b,
41  const bool a = true )
42  : red( r ), green( g ), blue( b ), alpha( a ) {}
43 
44  bool red;
45  bool green;
46  bool blue;
47  bool alpha;
48 
49  EQFABRIC_API static const ColorMask ALL;
50  };
51 
52  inline std::ostream& operator << ( std::ostream& os, const ColorMask& mask )
53  {
54  os << "[ ";
55  if( mask.red )
56  os << "RED ";
57  if( mask.green )
58  os << "GREEN ";
59  if( mask.blue )
60  os << "BLUE ";
61  os << "]";
62 
63  return os;
64  }
65 }
66 }
67 
68 namespace lunchbox
69 {
70 template<> inline void byteswap( eq::fabric::ColorMask& /*value*/ ) { /* NOP */ }
71 }
72 
73 #endif // EQFABRIC_COLORMASK_H
ColorMask(const bool r, const bool g, const bool b, const bool a=true)
Construct a color mask with given default values.
Definition: colorMask.h:40
Defines which parts of the color buffer are to be written.
Definition: colorMask.h:33
ColorMask()
Construct a color mask with all components enabled.
Definition: colorMask.h:37