Cleaned up the types.

This commit is contained in:
Robert Osfield
2005-01-05 17:14:38 +00:00
parent c58f56adb6
commit e2132cc62a
6 changed files with 70 additions and 94 deletions

View File

@@ -18,14 +18,14 @@
#ifndef GL_VERSION_1_2
/* Logic Ops */
#define GL_MIN 0x8007
#define GL_MAX 0x8008
#define GL_FUNC_ADD 0x8006
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
#define GL_ALPHA_MIN_SGIX 0x8320
#define GL_ALPHA_MAX_SGIX 0x8321
#define GL_LOGIC_OP 0x0BF1
#define GL_MIN 0x8007
#define GL_MAX 0x8008
#define GL_FUNC_ADD 0x8006
#define GL_FUNC_SUBTRACT 0x800A
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
#define GL_ALPHA_MIN_SGIX 0x8320
#define GL_ALPHA_MAX_SGIX 0x8321
#define GL_LOGIC_OP 0x0BF1
#endif
@@ -37,9 +37,20 @@ class SG_EXPORT BlendEquation : public StateAttribute
{
public :
enum Equation {
RGBA_MIN = GL_MIN,
RGBA_MAX = GL_MAX,
ALPHA_MIN = GL_ALPHA_MIN_SGIX,
ALPHA_MAX = GL_ALPHA_MAX_SGIX,
LOGIC_OP = GL_LOGIC_OP,
FUNC_ADD = GL_FUNC_ADD,
FUNC_SUBTRACT = GL_FUNC_SUBTRACT,
FUNC_REVERSE_SUBTRACT = GL_FUNC_REVERSE_SUBTRACT
};
BlendEquation();
BlendEquation(GLenum equation);
BlendEquation(Equation equation);
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
BlendEquation(const BlendEquation& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
@@ -67,23 +78,13 @@ class SG_EXPORT BlendEquation : public StateAttribute
return true;
}
enum BlendEquationEquation {
MIN_EXT = GL_MIN_EXT,
MAX_EXT = GL_MAX_EXT,
ALPHA_MIN_SGIX = GL_ALPHA_MIN_SGIX,
ALPHA_MAX_SGIX = GL_ALPHA_MAX_SGIX,
LOGIC_OP = GL_LOGIC_OP,
FUNC_ADD_EXT = GL_FUNC_ADD_EXT,
FUNC_SUBTRACT_EXT = GL_FUNC_SUBTRACT_EXT,
FUNC_REVERSE_SUBTRACT_EXT = GL_FUNC_REVERSE_SUBTRACT_EXT
};
inline void setEquation( GLenum equation )
inline void setEquation(Equation equation)
{
_equation = equation;
}
inline GLenum getEquation() const { return _equation; }
inline Equation getEquation() const { return _equation; }
virtual void apply(State& state) const;
/** Encapsulates queries of extension availability, obtains extension
@@ -134,7 +135,7 @@ class SG_EXPORT BlendEquation : public StateAttribute
virtual ~BlendEquation();
GLenum _equation;
Equation _equation;
};
}

View File

@@ -16,32 +16,6 @@
#include <osg/StateAttribute>
#ifndef GL_VERSION_1_2
/* Logic Ops */
#define GL_LOGIC_OP 0x0BF1
#define GL_INDEX_LOGIC_OP 0x0BF1
#define GL_COLOR_LOGIC_OP 0x0BF2
#define GL_LOGIC_OP_MODE 0x0BF0
#define GL_CLEAR 0x1500
#define GL_SET 0x150F
#define GL_COPY 0x1503
#define GL_COPY_INVERTED 0x150C
#define GL_NOOP 0x1505
#define GL_INVERT 0x150A
#define GL_AND 0x1501
#define GL_NAND 0x150E
#define GL_OR 0x1507
#define GL_NOR 0x1508
#define GL_XOR 0x1506
#define GL_EQUIV 0x1509
#define GL_AND_REVERSE 0x1502
#define GL_AND_INVERTED 0x1504
#define GL_OR_REVERSE 0x150B
#define GL_OR_INVERTED 0x150D
#endif
namespace osg {
/** Encapsulates OpenGL LogicOp state. */
@@ -49,9 +23,28 @@ class SG_EXPORT LogicOp : public StateAttribute
{
public :
enum Opcode {
CLEAR = GL_CLEAR,
SET = GL_SET,
COPY = GL_COPY,
COPY_INVERTED = GL_COPY_INVERTED,
NOOP = GL_NOOP,
INVERT = GL_INVERT,
AND = GL_AND,
NAND = GL_NAND,
OR = GL_OR,
NOR = GL_NOR,
XOR = GL_XOR,
EQUIV = GL_EQUIV,
AND_REVERSE = GL_AND_REVERSE,
AND_INVERTED = GL_AND_INVERTED,
OR_REVERSE = GL_OR_REVERSE,
OR_INVERTED = GL_OR_INVERTED
};
LogicOp();
LogicOp(GLenum opcode);
LogicOp(Opcode opcode);
/** Copy constructor using CopyOp to manage deep vs shallow copy. */
LogicOp(const LogicOp& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
@@ -79,31 +72,13 @@ class SG_EXPORT LogicOp : public StateAttribute
return true;
}
enum LogicOpOpcode {
CLEAR = GL_CLEAR,
SET = GL_SET,
COPY = GL_COPY,
COPY_INVERTED = GL_COPY_INVERTED,
NOOP = GL_NOOP,
INVERT = GL_INVERT,
AND = GL_AND,
NAND = GL_NAND,
OR = GL_OR,
NOR = GL_NOR,
XOR = GL_XOR,
EQUIV = GL_EQUIV,
AND_REVERSE = GL_AND_REVERSE,
AND_INVERTED = GL_AND_INVERTED,
OR_REVERSE = GL_OR_REVERSE,
OR_INVERTED = GL_OR_INVERTED
};
inline void setOpcode( GLenum opcode )
inline void setOpcode(Opcode opcode)
{
_opcode = opcode;
}
inline GLenum getOpcode() const { return _opcode; }
inline Opcode getOpcode() const { return _opcode; }
virtual void apply(State& state) const;
@@ -111,7 +86,7 @@ class SG_EXPORT LogicOp : public StateAttribute
virtual ~LogicOp();
GLenum _opcode;
Opcode _opcode;
};
}