Scissor
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_Scissor
#define OSG_Scissor 1
#include <osg/StateAttribute>
namespace osg {
class OSG_EXPORT Scissor : public StateAttribute
{
public :
Scissor();
Scissor(int x,int y,int width,int height):
_x(x),
_y(y),
_width(width),
_height(height) {}
Scissor(const Scissor& vp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(vp,copyop),
_x(vp._x),
_y(vp._y),
_width(vp._width),
_height(vp._height) {}
META_StateAttribute(osg, Scissor, SCISSOR);
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(Scissor,sa)
// compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_x)
COMPARE_StateAttribute_Parameter(_y)
COMPARE_StateAttribute_Parameter(_width)
COMPARE_StateAttribute_Parameter(_height)
return 0; // passed all the above comparison macros, must be equal.
}
virtual bool getModeUsage(StateAttribute::ModeUsage& usage) const
{
usage.usesMode(GL_SCISSOR_TEST);
return true;
}
inline void setScissor(int x,int y,int width,int height)
{
_x = x;
_y = y;
_width = width;
_height = height;
}
void getScissor(int& x,int& y,int& width,int& height) const
{
x = _x;
y = _y;
width = _width;
height = _height;
}
inline int& x() { return _x; }
inline int x() const { return _x; }
inline int& y() { return _y; }
inline int y() const { return _y; }
inline int& width() { return _width; }
inline int width() const { return _width; }
inline int& height() { return _height; }
inline int height() const { return _height; }
virtual void apply(State& state) const;
protected:
virtual ~Scissor();
int _x;
int _y;
int _width;
int _height;
};
}
#endif
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::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::Scissor::x
int x() const
Definition Scissor:84
osg::Scissor::Scissor
Scissor()
osg::Scissor::height
int height() const
Definition Scissor:93
osg::Scissor::_height
int _height
Definition Scissor:104
osg::Scissor::y
int y() const
Definition Scissor:87
osg::Scissor::_width
int _width
Definition Scissor:103
osg::Scissor::x
int & x()
Definition Scissor:83
osg::Scissor::_x
int _x
Definition Scissor:101
osg::Scissor::height
int & height()
Definition Scissor:92
osg::Scissor::setScissor
void setScissor(int x, int y, int width, int height)
Definition Scissor:67
osg::Scissor::width
int & width()
Definition Scissor:89
osg::Scissor::META_StateAttribute
META_StateAttribute(osg, Scissor, SCISSOR)
osg::Scissor::_y
int _y
Definition Scissor:102
osg::Scissor::apply
virtual void apply(State &state) const
osg::Scissor::getModeUsage
virtual bool getModeUsage(StateAttribute::ModeUsage &usage) const
Definition Scissor:61
osg::Scissor::compare
virtual int compare(const StateAttribute &sa) const
Definition Scissor:45
osg::Scissor::y
int & y()
Definition Scissor:86
osg::Scissor::~Scissor
virtual ~Scissor()
osg::Scissor::width
int width() const
Definition Scissor:90
osg::Scissor::getScissor
void getScissor(int &x, int &y, int &width, int &height) const
Definition Scissor:75
osg::Scissor::Scissor
Scissor(const Scissor &vp, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition Scissor:35
osg::Scissor::Scissor
Scissor(int x, int y, int width, int height)
Definition Scissor:27
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::SCISSOR
@ SCISSOR
Definition StateAttribute:156
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