OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PatchParameter.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
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.
7  *
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.
12 */
13 
14 #ifndef OSG_PATCHPARAMETER
15 #define OSG_PATCHPARAMETER 1
16 
17 #include <osg/Vec2>
18 #include <osg/Vec4>
19 #include <osg/StateAttribute>
20 
21 namespace osg {
22 
26 {
27  public :
28 
29  PatchParameter(GLint vertices=3);
30 
33  StateAttribute(rhs,copyop),
34  _vertices(rhs._vertices),
35  _patchDefaultInnerLevel(rhs._patchDefaultInnerLevel),
36  _patchDefaultOuterLevel(rhs._patchDefaultOuterLevel) {}
37 
38 
39  META_StateAttribute(osg, PatchParameter, PATCH_PARAMETER);
40 
42  virtual int compare(const StateAttribute& sa) const
43  {
44  // check the types are equal and then create the rhs variable
45  // used by the COMPARE_StateAttribute_Parameter macros below.
47 
48  // compare each parameter in turn against the rhs.
50  COMPARE_StateAttribute_Parameter(_patchDefaultInnerLevel)
51  COMPARE_StateAttribute_Parameter(_patchDefaultOuterLevel)
52 
53  return 0; // passed all the above comparison macros, must be equal.
54  }
55 
57  void setVertices(GLint vertices) { _vertices = vertices; }
58 
60  GLint getVertices() const { return _vertices; }
61 
63  void setPatchDefaultInnerLevel(const osg::Vec2& level) { _patchDefaultInnerLevel = level; }
64 
66  const osg::Vec2& getPatchDefaultInnerLevel() const { return _patchDefaultInnerLevel; }
67 
69  void setPatchDefaultOuterLevel(const osg::Vec4& level) { _patchDefaultOuterLevel = level; }
70 
72  const osg::Vec4& getPatchDefaultOuterLevel() const { return _patchDefaultOuterLevel; }
73 
74  virtual void apply(State& state) const;
75 
76  protected:
77 
78  virtual ~PatchParameter();
79 
80  GLint _vertices;
83 };
84 
85 }
86 
87 #endif
GLint getVertices() const
#define OSG_EXPORT
Definition: Export.h:43
const osg::Vec2 & getPatchDefaultInnerLevel() const
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
osg::Vec4 _patchDefaultOuterLevel
void setPatchDefaultInnerLevel(const osg::Vec2 &level)
osg::Vec2 _patchDefaultInnerLevel
void setPatchDefaultOuterLevel(const osg::Vec4 &level)
PatchParameter(const PatchParameter &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
void setVertices(GLint vertices)
#define META_StateAttribute(library, name, type)
GLint level
Definition: GLU.h:71
Definition: AlphaFunc.h:19
const osg::Vec4 & getPatchDefaultOuterLevel() const
#define COMPARE_StateAttribute_Parameter(parameter)
virtual int compare(const StateAttribute &sa) const