Line data Source code
1 :
2 : /* Copyright (c) 2007-2014, 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 <lunchbox/bitOperation.h>
23 : #include <iostream>
24 :
25 : namespace eq
26 : {
27 : namespace fabric
28 : {
29 : /**
30 : * Defines which parts of the color buffer are to be written.
31 : *
32 : * Used to configure anaglyphic stereo rendering.
33 : */
34 : class ColorMask
35 : {
36 : public:
37 : /** Construct a color mask with all components enabled. @version 1.0 */
38 4208 : ColorMask() : red( true ), green( true ), blue( true ), alpha( true ) {}
39 :
40 : /** Construct a color mask with given default values. @version 1.0 */
41 : ColorMask( const bool r, const bool g, const bool b,
42 : const bool a = true )
43 : : red( r ), green( g ), blue( b ), alpha( a ) {}
44 :
45 : bool red;
46 : bool green;
47 : bool blue;
48 : bool alpha;
49 :
50 : EQFABRIC_API static const ColorMask ALL;
51 : };
52 :
53 6 : inline std::ostream& operator << ( std::ostream& os, const ColorMask& mask )
54 : {
55 6 : os << "[ ";
56 6 : if( mask.red )
57 5 : os << "RED ";
58 6 : if( mask.green )
59 5 : os << "GREEN ";
60 6 : if( mask.blue )
61 5 : os << "BLUE ";
62 6 : os << "]";
63 :
64 6 : return os;
65 : }
66 : }
67 : }
68 :
69 : namespace lunchbox
70 : {
71 0 : template<> inline void byteswap( eq::fabric::ColorMask& /*value*/ ) { /* NOP */ }
72 : }
73 :
74 : #endif // EQFABRIC_COLORMASK_H
|