ClipControl
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_CLIPCONTROL
#define OSG_CLIPCONTROL 1
#include <osg/StateAttribute>
#ifndef GL_VERSION_4_5
#define GL_NEGATIVE_ONE_TO_ONE 0x935E
#define GL_ZERO_TO_ONE 0x935F
#endif
namespace osg {
class OSG_EXPORT ClipControl : public StateAttribute
{
public :
enum Origin
{
LOWER_LEFT = GL_LOWER_LEFT,
UPPER_LEFT = GL_UPPER_LEFT
};
enum DepthMode
{
NEGATIVE_ONE_TO_ONE = GL_NEGATIVE_ONE_TO_ONE,
ZERO_TO_ONE = GL_ZERO_TO_ONE
};
ClipControl(Origin origin=LOWER_LEFT, DepthMode depthMode=NEGATIVE_ONE_TO_ONE);
ClipControl(const ClipControl& clipControl,const CopyOp& copyop=CopyOp::SHALLOW_COPY);
META_StateAttribute(osg, ClipControl, CLIPCONTROL);
virtual int compare(const StateAttribute& sa) const
{
// check the types are equal and then create the rhs variable
// used by the COMPARE_StateAttribute_Parameter macros below.
COMPARE_StateAttribute_Types(ClipControl,sa)
// compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_origin)
COMPARE_StateAttribute_Parameter(_depthMode)
return 0; // passed all the above comparison macros, must be equal.
}
void setOrigin(Origin origin) { _origin = origin; }
Origin getOrigin() const { return _origin; }
void setDepthMode(DepthMode depthMode) { _depthMode = depthMode; }
DepthMode getDepthMode() const { return _depthMode; }
virtual void apply(State& state) const;
protected:
virtual ~ClipControl();
Origin _origin;
DepthMode _depthMode;
};
}
#endif
GL_ZERO_TO_ONE
#define GL_ZERO_TO_ONE
Definition ClipControl:21
GL_NEGATIVE_ONE_TO_ONE
#define GL_NEGATIVE_ONE_TO_ONE
Definition ClipControl:20
GL_UPPER_LEFT
#define GL_UPPER_LEFT
Definition GLDefines:129
GL_LOWER_LEFT
#define GL_LOWER_LEFT
Definition GLDefines:128
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::ClipControl::ClipControl
ClipControl(const ClipControl &clipControl, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
osg::ClipControl::setOrigin
void setOrigin(Origin origin)
Definition ClipControl:67
osg::ClipControl::_depthMode
DepthMode _depthMode
Definition ClipControl:80
osg::ClipControl::~ClipControl
virtual ~ClipControl()
osg::ClipControl::setDepthMode
void setDepthMode(DepthMode depthMode)
Definition ClipControl:70
osg::ClipControl::getDepthMode
DepthMode getDepthMode() const
Definition ClipControl:71
osg::ClipControl::DepthMode
DepthMode
Definition ClipControl:39
osg::ClipControl::NEGATIVE_ONE_TO_ONE
@ NEGATIVE_ONE_TO_ONE
Definition ClipControl:40
osg::ClipControl::ZERO_TO_ONE
@ ZERO_TO_ONE
Definition ClipControl:41
osg::ClipControl::ClipControl
ClipControl(Origin origin=LOWER_LEFT, DepthMode depthMode=NEGATIVE_ONE_TO_ONE)
osg::ClipControl::getOrigin
Origin getOrigin() const
Definition ClipControl:68
osg::ClipControl::_origin
Origin _origin
Definition ClipControl:79
osg::ClipControl::META_StateAttribute
META_StateAttribute(osg, ClipControl, CLIPCONTROL)
osg::ClipControl::Origin
Origin
Definition ClipControl:33
osg::ClipControl::UPPER_LEFT
@ UPPER_LEFT
Definition ClipControl:35
osg::ClipControl::LOWER_LEFT
@ LOWER_LEFT
Definition ClipControl:34
osg::ClipControl::apply
virtual void apply(State &state) const
osg::ClipControl::compare
virtual int compare(const StateAttribute &sa) const
Definition ClipControl:54
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::CLIPCONTROL
@ CLIPCONTROL
Definition StateAttribute:169
osg::State
Definition State:80
osg
Definition AlphaFunc:19
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39