Cleaned up the types.
This commit is contained in:
parent
c58f56adb6
commit
e2132cc62a
@ -36,28 +36,28 @@ protected:
|
||||
|
||||
static const int _eq_nb=8;
|
||||
int _eq_index;
|
||||
static const unsigned int _equations[_eq_nb];
|
||||
static const osg::BlendEquation::Equation _equations[_eq_nb];
|
||||
static const char* _equations_name[_eq_nb];
|
||||
};
|
||||
const unsigned int TechniqueEventHandler::_equations[_eq_nb]={
|
||||
osg::BlendEquation::FUNC_ADD_EXT,
|
||||
osg::BlendEquation::FUNC_SUBTRACT_EXT,
|
||||
osg::BlendEquation::FUNC_REVERSE_SUBTRACT_EXT,
|
||||
osg::BlendEquation::MIN_EXT,
|
||||
osg::BlendEquation::MAX_EXT,
|
||||
osg::BlendEquation::ALPHA_MIN_SGIX,
|
||||
osg::BlendEquation::ALPHA_MAX_SGIX,
|
||||
const osg::BlendEquation::Equation TechniqueEventHandler::_equations[_eq_nb]={
|
||||
osg::BlendEquation::FUNC_ADD,
|
||||
osg::BlendEquation::FUNC_SUBTRACT,
|
||||
osg::BlendEquation::FUNC_REVERSE_SUBTRACT,
|
||||
osg::BlendEquation::RGBA_MIN,
|
||||
osg::BlendEquation::RGBA_MAX,
|
||||
osg::BlendEquation::ALPHA_MIN,
|
||||
osg::BlendEquation::ALPHA_MAX,
|
||||
osg::BlendEquation::LOGIC_OP
|
||||
};
|
||||
|
||||
const char* TechniqueEventHandler::_equations_name[_eq_nb]={
|
||||
"osg::BlendEquation::FUNC_ADD_EXT",
|
||||
"osg::BlendEquation::FUNC_SUBTRACT_EXT",
|
||||
"osg::BlendEquation::FUNC_REVERSE_SUBTRACT_EXT",
|
||||
"osg::BlendEquation::MIN_EXT",
|
||||
"osg::BlendEquation::MAX_EXT",
|
||||
"osg::BlendEquation::ALPHA_MIN_SGIX",
|
||||
"osg::BlendEquation::ALPHA_MAX_SGIX",
|
||||
"osg::BlendEquation::FUNC_ADD",
|
||||
"osg::BlendEquation::FUNC_SUBTRACT",
|
||||
"osg::BlendEquation::FUNC_REVERSE_SUBTRACT",
|
||||
"osg::BlendEquation::RGBA_MIN",
|
||||
"osg::BlendEquation::RGBA_MAX",
|
||||
"osg::BlendEquation::ALPHA_MIN",
|
||||
"osg::BlendEquation::ALPHA_MAX",
|
||||
"osg::BlendEquation::LOGIC_OP"
|
||||
};
|
||||
|
||||
@ -132,7 +132,7 @@ int main( int argc, char **argv )
|
||||
|
||||
|
||||
osg::StateSet* stateset = new osg::StateSet;
|
||||
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD_EXT);
|
||||
osg::BlendEquation* blendEquation = new osg::BlendEquation(osg::BlendEquation::FUNC_ADD);
|
||||
|
||||
stateset->setAttributeAndModes(blendEquation,osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
|
||||
|
||||
|
@ -36,11 +36,11 @@ protected:
|
||||
|
||||
static const int _ops_nb=16;
|
||||
int _ops_index;
|
||||
static const unsigned int _operations[_ops_nb];
|
||||
static const osg::LogicOp::Opcode _operations[_ops_nb];
|
||||
static const char* _ops_name[_ops_nb];
|
||||
|
||||
};
|
||||
const unsigned int TechniqueEventHandler::_operations[_ops_nb]={
|
||||
const osg::LogicOp::Opcode TechniqueEventHandler::_operations[_ops_nb]={
|
||||
osg::LogicOp::CLEAR,
|
||||
osg::LogicOp::SET,
|
||||
osg::LogicOp::COPY,
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -20,11 +20,11 @@
|
||||
using namespace osg;
|
||||
|
||||
BlendEquation::BlendEquation():
|
||||
_equation(FUNC_ADD_EXT)
|
||||
_equation(FUNC_ADD)
|
||||
{
|
||||
}
|
||||
|
||||
BlendEquation::BlendEquation(GLenum equation):
|
||||
BlendEquation::BlendEquation(Equation equation):
|
||||
_equation(equation)
|
||||
{
|
||||
}
|
||||
@ -48,7 +48,7 @@ void BlendEquation::apply(State& state) const
|
||||
return;
|
||||
}
|
||||
|
||||
extensions->glBlendEquation(_equation);
|
||||
extensions->glBlendEquation(static_cast<GLenum>(_equation));
|
||||
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@ LogicOp::LogicOp():
|
||||
{
|
||||
}
|
||||
|
||||
LogicOp::LogicOp(GLenum opcode):
|
||||
LogicOp::LogicOp(Opcode opcode):
|
||||
_opcode(opcode)
|
||||
{
|
||||
}
|
||||
@ -30,6 +30,6 @@ LogicOp::~LogicOp()
|
||||
|
||||
void LogicOp::apply(State&) const
|
||||
{
|
||||
glLogicOp(_opcode);
|
||||
glLogicOp(static_cast<GLenum>(_opcode));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user