PatchParameter
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_PATCHPARAMETER
#define OSG_PATCHPARAMETER 1
#include <osg/Vec2>
#include <osg/Vec4>
#include <osg/StateAttribute>
namespace osg {
class OSG_EXPORT PatchParameter : public StateAttribute
{
public :
PatchParameter(GLint vertices=3);
PatchParameter(const PatchParameter& rhs,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
StateAttribute(rhs,copyop),
_vertices(rhs._vertices),
_patchDefaultInnerLevel(rhs._patchDefaultInnerLevel),
_patchDefaultOuterLevel(rhs._patchDefaultOuterLevel) {}
META_StateAttribute(osg, PatchParameter, PATCH_PARAMETER);
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(PatchParameter,sa)
// compare each parameter in turn against the rhs.
COMPARE_StateAttribute_Parameter(_vertices)
COMPARE_StateAttribute_Parameter(_patchDefaultInnerLevel)
COMPARE_StateAttribute_Parameter(_patchDefaultOuterLevel)
return 0; // passed all the above comparison macros, must be equal.
}
void setVertices(GLint vertices) { _vertices = vertices; }
GLint getVertices() const { return _vertices; }
void setPatchDefaultInnerLevel(const osg::Vec2& level) { _patchDefaultInnerLevel = level; }
const osg::Vec2& getPatchDefaultInnerLevel() const { return _patchDefaultInnerLevel; }
void setPatchDefaultOuterLevel(const osg::Vec4& level) { _patchDefaultOuterLevel = level; }
const osg::Vec4& getPatchDefaultOuterLevel() const { return _patchDefaultOuterLevel; }
virtual void apply(State& state) const;
protected:
virtual ~PatchParameter();
GLint _vertices;
osg::Vec2 _patchDefaultInnerLevel;
osg::Vec4 _patchDefaultOuterLevel;
};
}
#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
Vec2
Vec4
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::PatchParameter::getPatchDefaultInnerLevel
const osg::Vec2 & getPatchDefaultInnerLevel() const
Definition PatchParameter:66
osg::PatchParameter::~PatchParameter
virtual ~PatchParameter()
osg::PatchParameter::setPatchDefaultInnerLevel
void setPatchDefaultInnerLevel(const osg::Vec2 &level)
Definition PatchParameter:63
osg::PatchParameter::_patchDefaultInnerLevel
osg::Vec2 _patchDefaultInnerLevel
Definition PatchParameter:81
osg::PatchParameter::PatchParameter
PatchParameter(GLint vertices=3)
osg::PatchParameter::_vertices
GLint _vertices
Definition PatchParameter:80
osg::PatchParameter::compare
virtual int compare(const StateAttribute &sa) const
Definition PatchParameter:42
osg::PatchParameter::setVertices
void setVertices(GLint vertices)
Definition PatchParameter:57
osg::PatchParameter::getPatchDefaultOuterLevel
const osg::Vec4 & getPatchDefaultOuterLevel() const
Definition PatchParameter:72
osg::PatchParameter::apply
virtual void apply(State &state) const
osg::PatchParameter::getVertices
GLint getVertices() const
Definition PatchParameter:60
osg::PatchParameter::setPatchDefaultOuterLevel
void setPatchDefaultOuterLevel(const osg::Vec4 &level)
Definition PatchParameter:69
osg::PatchParameter::META_StateAttribute
META_StateAttribute(osg, PatchParameter, PATCH_PARAMETER)
osg::PatchParameter::_patchDefaultOuterLevel
osg::Vec4 _patchDefaultOuterLevel
Definition PatchParameter:82
osg::PatchParameter::PatchParameter
PatchParameter(const PatchParameter &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PatchParameter:32
osg::StateAttribute::StateAttribute
StateAttribute()
osg::StateAttribute::PATCH_PARAMETER
@ PATCH_PARAMETER
Definition StateAttribute:197
osg::State
Definition State:80
osg
Definition AlphaFunc:19
osg::Vec2
Vec2f Vec2
Definition Vec2:21
osg::Vec4
Vec4f Vec4
Definition Vec4:21
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39