OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LogicOp.h
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_LOGICOP
15 #define OSG_LOGICOP 1
16 
17 #include <osg/StateAttribute>
18 
19 #ifndef OSG_GL_FIXED_FUNCTION_AVAILABLE
20  #define GL_CLEAR 0x1500
21  #define GL_SET 0x150F
22  #define GL_COPY 0x1503
23  #define GL_COPY_INVERTED 0x150C
24  #define GL_NOOP 0x1505
25  #define GL_AND 0x1501
26  #define GL_NAND 0x150E
27  #define GL_OR 0x1507
28  #define GL_NOR 0x1508
29  #define GL_XOR 0x1506
30  #define GL_EQUIV 0x1509
31  #define GL_AND_REVERSE 0x1502
32  #define GL_AND_INVERTED 0x1504
33  #define GL_OR_REVERSE 0x150B
34  #define GL_OR_INVERTED 0x150D
35  #define GL_COLOR_LOGIC_OP 0x0BF2
36 #endif
37 
38 namespace osg {
39 
42 {
43  public :
44 
45  enum Opcode {
46  CLEAR = GL_CLEAR,
47  SET = GL_SET,
48  COPY = GL_COPY,
49  COPY_INVERTED = GL_COPY_INVERTED,
50  NOOP = GL_NOOP,
51  INVERT = GL_INVERT,
52  AND = GL_AND,
53  NAND = GL_NAND,
54  OR = GL_OR,
55  NOR = GL_NOR,
56  XOR = GL_XOR,
57  EQUIV = GL_EQUIV,
58  AND_REVERSE = GL_AND_REVERSE,
59  AND_INVERTED = GL_AND_INVERTED,
60  OR_REVERSE = GL_OR_REVERSE,
61  OR_INVERTED = GL_OR_INVERTED
62  };
63 
64  LogicOp();
65 
66  LogicOp(Opcode opcode);
67 
69  LogicOp(const LogicOp& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
70  StateAttribute(trans,copyop),
71  _opcode(trans._opcode){}
72 
74 
76  virtual int compare(const StateAttribute& sa) const
77  {
78  // Check for equal types, then create the rhs variable
79  // used by the COMPARE_StateAttribute_Parameter macros below.
81 
82  // Compare each parameter in turn against the rhs.
84 
85  return 0; // Passed all the above comparison macros, so must be equal.
86  }
87 
88  virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
89  {
91  return true;
92  }
93 
94 
95  inline void setOpcode(Opcode opcode)
96  {
97  _opcode = opcode;
98  }
99 
100  inline Opcode getOpcode() const { return _opcode; }
101 
102  virtual void apply(State& state) const;
103 
104  protected :
105 
106  virtual ~LogicOp();
107 
109 };
110 
111 }
112 
113 #endif
#define GL_OR
Definition: LogicOp.h:27
#define OSG_EXPORT
Definition: Export.h:43
#define GL_CLEAR
Definition: LogicOp.h:20
#define GL_COPY_INVERTED
Definition: LogicOp.h:23
#define GL_COLOR_LOGIC_OP
Definition: LogicOp.h:35
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
#define GL_XOR
Definition: LogicOp.h:29
Opcode getOpcode() const
Definition: LogicOp.h:100
#define GL_OR_INVERTED
Definition: LogicOp.h:34
#define GL_COPY
Definition: LogicOp.h:22
void setOpcode(Opcode opcode)
Definition: LogicOp.h:95
#define GL_AND_INVERTED
Definition: LogicOp.h:32
virtual void usesMode(GLMode mode)=0
#define GL_NAND
Definition: LogicOp.h:26
Opcode _opcode
Definition: LogicOp.h:108
LogicOp(const LogicOp &trans, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: LogicOp.h:69
#define GL_NOR
Definition: LogicOp.h:28
#define GL_AND
Definition: LogicOp.h:25
virtual int compare(const StateAttribute &sa) const
Definition: LogicOp.h:76
#define META_StateAttribute(library, name, type)
#define GL_OR_REVERSE
Definition: LogicOp.h:33
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition: LogicOp.h:88
Definition: AlphaFunc.h:19
#define GL_EQUIV
Definition: LogicOp.h:30
#define GL_AND_REVERSE
Definition: LogicOp.h:31
#define GL_SET
Definition: LogicOp.h:21
#define COMPARE_StateAttribute_Parameter(parameter)
#define GL_NOOP
Definition: LogicOp.h:24