openscenegraph
PatchParameter
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
21namespace osg {
22
26{
27 public :
28
29 PatchParameter(GLint vertices=3);
30
32 PatchParameter(const PatchParameter& rhs,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
33 StateAttribute(rhs,copyop),
34 _vertices(rhs._vertices),
35 _patchDefaultInnerLevel(rhs._patchDefaultInnerLevel),
36 _patchDefaultOuterLevel(rhs._patchDefaultOuterLevel) {}
37
38
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
#define COMPARE_StateAttribute_Parameter(parameter)
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
Definition StateAttribute:57
Definition CopyOp:41
Definition PatchParameter:26
const osg::Vec2 & getPatchDefaultInnerLevel() const
Definition PatchParameter:66
virtual ~PatchParameter()
void setPatchDefaultInnerLevel(const osg::Vec2 &level)
Definition PatchParameter:63
osg::Vec2 _patchDefaultInnerLevel
Definition PatchParameter:81
PatchParameter(GLint vertices=3)
GLint _vertices
Definition PatchParameter:80
virtual int compare(const StateAttribute &sa) const
Definition PatchParameter:42
void setVertices(GLint vertices)
Definition PatchParameter:57
const osg::Vec4 & getPatchDefaultOuterLevel() const
Definition PatchParameter:72
virtual void apply(State &state) const
GLint getVertices() const
Definition PatchParameter:60
void setPatchDefaultOuterLevel(const osg::Vec4 &level)
Definition PatchParameter:69
META_StateAttribute(osg, PatchParameter, PATCH_PARAMETER)
osg::Vec4 _patchDefaultOuterLevel
Definition PatchParameter:82
PatchParameter(const PatchParameter &rhs, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition PatchParameter:32
Definition StateAttribute:77
Definition State:80
Definition Vec2f:29
Definition Vec4f:28
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
#define OSG_EXPORT
Definition osg/Export:39