BlendEquation
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_BLENDEQUATION
#define OSG_BLENDEQUATION 1
#include <osg/StateAttribute>
#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
#endif
#ifndef GL_LOGIC_OP
#define GL_LOGIC_OP 0x0BF1
#endif
#ifndef GL_ALPHA_MIN_SGIX
#define GL_ALPHA_MIN_SGIX 0x8320
#define GL_ALPHA_MAX_SGIX 0x8321
#endif
namespace osg {
class OSG_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(Equation equation);
BlendEquation(Equation equationRGB, Equation equationAlpha);
BlendEquation(const BlendEquation& trans,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(trans,copyop),
_equationRGB(trans._equationRGB),
_equationAlpha(trans._equationAlpha){}
META_StateAttribute(osg, BlendEquation,BLENDEQUATION);
virtual int compare(const StateAttribute& sa) const
{
// Check for equal types, then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(BlendEquation,sa)
// Compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_equationRGB)
COMPARE_StateAttribute_Parameter(_equationAlpha)
return 0; // Passed all the above comparison macros, so must be equal.
}
virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
{
usage.usesMode(GL_BLEND);
return true;
}
inline void setEquation(Equation equation) { _equationRGB = _equationAlpha = equation; }
inline Equation getEquation() const { return _equationRGB; }
inline void setEquationRGB(Equation equation) { _equationRGB = equation; }
inline Equation getEquationRGB() const { return _equationRGB; }
inline void setEquationAlpha(Equation equation) { _equationAlpha = equation; }
inline Equation getEquationAlpha() const { return _equationAlpha; }
virtual void apply(State& state) const;
protected :
virtual ~BlendEquation();
Equation _equationRGB, _equationAlpha;
};
}
#endif
GL_ALPHA_MAX_SGIX
#define GL_ALPHA_MAX_SGIX
Definition BlendEquation:34
GL_ALPHA_MIN_SGIX
#define GL_ALPHA_MIN_SGIX
Definition BlendEquation:33
GL_LOGIC_OP
#define GL_LOGIC_OP
Definition BlendEquation:29
GL_FUNC_REVERSE_SUBTRACT
#define GL_FUNC_REVERSE_SUBTRACT
Definition BlendEquation:25
GL_MIN
#define GL_MIN
Definition BlendEquation:21
GL_FUNC_SUBTRACT
#define GL_FUNC_SUBTRACT
Definition BlendEquation:24
GL_MAX
#define GL_MAX
Definition BlendEquation:22
GL_FUNC_ADD
#define GL_FUNC_ADD
Definition BlendEquation:23
StateAttribute
COMPARE_StateAttribute_Parameter
#define COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
COMPARE_StateAttribute_Types
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
osg::BlendEquation::getModeUsage
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition BlendEquation:83
osg::BlendEquation::getEquationRGB
Equation getEquationRGB() const
Definition BlendEquation:94
osg::BlendEquation::META_StateAttribute
META_StateAttribute(osg, BlendEquation, BLENDEQUATION)
osg::BlendEquation::setEquation
void setEquation(Equation equation)
Definition BlendEquation:90
osg::BlendEquation::setEquationAlpha
void setEquationAlpha(Equation equation)
Definition BlendEquation:96
osg::BlendEquation::getEquationAlpha
Equation getEquationAlpha() const
Definition BlendEquation:97
osg::BlendEquation::BlendEquation
BlendEquation(const BlendEquation &trans, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition BlendEquation:62
osg::BlendEquation::BlendEquation
BlendEquation(Equation equation)
osg::BlendEquation::BlendEquation
BlendEquation(Equation equationRGB, Equation equationAlpha)
osg::BlendEquation::setEquationRGB
void setEquationRGB(Equation equation)
Definition BlendEquation:93
osg::BlendEquation::compare
virtual int compare(const StateAttribute &sa) const
Definition BlendEquation:70
osg::BlendEquation::_equationAlpha
Equation _equationAlpha
Definition BlendEquation:106
osg::BlendEquation::Equation
Equation
Definition BlendEquation:44
osg::BlendEquation::FUNC_REVERSE_SUBTRACT
@ FUNC_REVERSE_SUBTRACT
Definition BlendEquation:52
osg::BlendEquation::RGBA_MIN
@ RGBA_MIN
Definition BlendEquation:45
osg::BlendEquation::LOGIC_OP
@ LOGIC_OP
Definition BlendEquation:49
osg::BlendEquation::ALPHA_MIN
@ ALPHA_MIN
Definition BlendEquation:47
osg::BlendEquation::FUNC_ADD
@ FUNC_ADD
Definition BlendEquation:50
osg::BlendEquation::ALPHA_MAX
@ ALPHA_MAX
Definition BlendEquation:48
osg::BlendEquation::RGBA_MAX
@ RGBA_MAX
Definition BlendEquation:46
osg::BlendEquation::FUNC_SUBTRACT
@ FUNC_SUBTRACT
Definition BlendEquation:51
osg::BlendEquation::~BlendEquation
virtual ~BlendEquation()
osg::BlendEquation::BlendEquation
BlendEquation()
osg::BlendEquation::_equationRGB
Equation _equationRGB
Definition BlendEquation:106
osg::BlendEquation::apply
virtual void apply(State &state) const
osg::BlendEquation::getEquation
Equation getEquation() const
Definition BlendEquation:91
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::BLENDEQUATION
@ BLENDEQUATION
Definition StateAttribute:150
osg::State
Definition State:80
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39
osg::StateAttribute::ModeUsage
Definition StateAttribute:308
osg::StateAttribute::ModeUsage::usesMode
virtual void usesMode(GLMode mode)=0