OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VertexAttribDivisor.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_VERTEXATTRIBDIVISOR
15 #define OSG_VERTEXATTRIBDIVISOR 1
16 
17 #include <osg/StateAttribute>
18 #include <osg/Vec3>
19 #include <osg/Vec4>
20 
21 namespace osg {
22 
25 {
26  public :
27 
29 
30  VertexAttribDivisor(unsigned int index, unsigned int divisor);
31 
34  StateAttribute(vad,copyop),
35  _index(vad._index),
36  _divisor(vad._divisor) {}
37 
38  virtual osg::Object* cloneType() const { return new VertexAttribDivisor(_index, 0); }
39  virtual osg::Object* clone(const osg::CopyOp& copyop) const { return new VertexAttribDivisor(*this,copyop); }
40  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const VertexAttribDivisor *>(obj)!=NULL; }
41  virtual const char* libraryName() const { return "osg"; }
42  virtual const char* className() const { return "VertexAttribDivisor"; }
43  virtual Type getType() const { return VERTEX_ATTRIB_DIVISOR; }
44 
46  virtual int compare(const StateAttribute& sa) const
47  {
48  // check the types are equal and then create the rhs variable
49  // used by the COMPARE_StateAttribute_Parameter macros below.
51 
52  // compare each parameter in turn against the rhs.
54 
55  return 0; // passed all the above comparison macros, must be equal.
56  }
57 
58  virtual unsigned int getMember() const { return _index; }
59 
60 
62  inline void setIndex( unsigned int index ) { _index = index; }
63 
65  inline unsigned int getIndex() const { return _index; }
66 
68  inline void setDivisor( unsigned int divisor ) { _divisor = divisor; }
69 
71  inline unsigned int getDivisor() const { return _divisor; }
72 
74  virtual void apply(State& state) const;
75 
76  protected :
77 
78  virtual ~VertexAttribDivisor();
79 
80  unsigned int _index;
81  unsigned int _divisor;
82 };
83 
84 }
85 
86 #endif
#define OSG_EXPORT
Definition: Export.h:43
virtual unsigned int getMember() const
#define NULL
Definition: Export.h:59
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
virtual Type getType() const
virtual osg::Object * clone(const osg::CopyOp &copyop) const
virtual int compare(const StateAttribute &sa) const
unsigned int getIndex() const
unsigned int getDivisor() const
virtual const char * libraryName() const
virtual bool isSameKindAs(const osg::Object *obj) const
virtual osg::Object * cloneType() const
void setIndex(unsigned int index)
VertexAttribDivisor(const VertexAttribDivisor &vad, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Definition: AlphaFunc.h:19
void setDivisor(unsigned int divisor)
#define COMPARE_StateAttribute_Parameter(parameter)
virtual const char * className() const