1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2016 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14#ifndef OSG_ScissorIndexed
15#define OSG_ScissorIndexed 1
21/** Encapsulates glScissorIndexed function : the index version of glDepth
23class OSG_EXPORT ScissorIndexed : public osg::StateAttribute
29 ScissorIndexed(unsigned int index, float x, float y, float width, float height):
36 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
37 ScissorIndexed(const ScissorIndexed& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
38 StateAttribute(dp,copyop),
43 _height(dp._height) {}
45 META_StateAttribute(osg, ScissorIndexed, SCISSORINDEXED);
47 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
48 virtual int compare(const StateAttribute& sa) const
50 // Check for equal types, then create the rhs variable
51 // used by the COMPARE_StateAttribute_Parameter macros below.
52 COMPARE_StateAttribute_Types(ScissorIndexed,sa)
54 COMPARE_StateAttribute_Parameter(_index);
55 COMPARE_StateAttribute_Parameter(_x)
56 COMPARE_StateAttribute_Parameter(_y)
57 COMPARE_StateAttribute_Parameter(_width)
58 COMPARE_StateAttribute_Parameter(_height)
63 /** Return the buffer index as the member identifier.*/
64 virtual unsigned int getMember() const { return _index; }
66 /** Set the index of the ScissorIndexed. */
67 void setIndex(unsigned int index);
69 /** Get the index of the ScissorIndexed. */
70 unsigned int getIndex() const { return _index; }
72 inline void setX(float x) { _x=x; }
73 inline float getX() const { return _x; }
75 inline void setY(float y) { _y=y; }
76 inline float getY() const { return _y; }
78 inline void setWidth(float w) { _width=w; }
79 inline float getWidth() const { return _width; }
81 inline void setHeight(float height) { _height=height; }
82 inline float getHeight() const { return _height; }
84 virtual void apply(State& state) const;
88 virtual ~ScissorIndexed();