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_DepthRangeIndexed
15#define OSG_DepthRangeIndexed 1
21/** Encapsulates glDepthRangeIndexed function : the index version of glDepth
23class OSG_EXPORT DepthRangeIndexed : public osg::StateAttribute
29 DepthRangeIndexed(unsigned int index, double zNear=0.0, double zFar=1.0):
34 /** Copy constructor using CopyOp to manage deep vs shallow copy. */
35 DepthRangeIndexed(const DepthRangeIndexed& dp,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
36 StateAttribute(dp,copyop),
41 META_StateAttribute(osg, DepthRangeIndexed, DEPTHRANGEINDEXED);
43 /** Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. */
44 virtual int compare(const StateAttribute& sa) const
46 // Check for equal types, then create the rhs variable
47 // used by the COMPARE_StateAttribute_Parameter macros below.
48 COMPARE_StateAttribute_Types(DepthRangeIndexed,sa)
50 COMPARE_StateAttribute_Parameter(_index);
51 COMPARE_StateAttribute_Parameter(_zNear)
52 COMPARE_StateAttribute_Parameter(_zFar)
57 /** Return the buffer index as the member identifier.*/
58 virtual unsigned int getMember() const { return _index; }
60 /** Set the index of the DepthRangeIndexed. */
61 void setIndex(unsigned int index);
63 /** Get the index of the DepthRangeIndexed. */
64 unsigned int getIndex() const { return _index; }
66 inline void setZNear(double zNear) { _zNear=zNear; }
67 inline double getZNear() const { return _zNear; }
69 inline void setZFar(double zFar) { _zFar=zFar; }
70 inline double getZFar() const { return _zFar; }
72 virtual void apply(State& state) const;
76 virtual ~DepthRangeIndexed();