OpenSceneGraph 3.6.5
VertexAttribDivisor
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
21namespace 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.
55
56 return 0; // passed all the above comparison macros, must be equal.
57 }
58
59 virtual unsigned int getMember() const { return _index; }
60
61
63 inline void setIndex( unsigned int index ) { _index = index; }
64
66 inline unsigned int getIndex() const { return _index; }
67
69 inline void setDivisor( unsigned int divisor ) { _divisor = divisor; }
70
72 inline unsigned int getDivisor() const { return _divisor; }
73
75 virtual void apply(State& state) const;
76
77 protected :
78
80
81 unsigned int _index;
82 unsigned int _divisor;
83};
84
85}
86
87#endif
#define COMPARE_StateAttribute_Parameter(parameter)
COMPARE_StateAttribute_Parameter macro is a helper for implementing the StatateAtribute::compare(....
Definition StateAttribute:69
#define COMPARE_StateAttribute_Types(TYPE, rhs_attribute)
COMPARE_StateAttribute_Types macro is a helper for implementing the StateAtribute::compare(....
Definition StateAttribute:57
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Type
Type identifier to differentiate between different state types.
Definition StateAttribute:124
@ VERTEX_ATTRIB_DIVISOR
Definition StateAttribute:201
virtual int compare(const StateAttribute &sa) const
Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
Definition VertexAttribDivisor:46
virtual unsigned int getMember() const
Return the member identifier within the attribute's class type.
Definition VertexAttribDivisor:59
void setDivisor(unsigned int divisor)
Set the vertex attrib divisor.
Definition VertexAttribDivisor:69
virtual osg::Object * clone(const osg::CopyOp &copyop) const
Clone an attribute, with Object* return type.
Definition VertexAttribDivisor:39
unsigned int getIndex() const
Get the vertex attrib index.
Definition VertexAttribDivisor:66
VertexAttribDivisor(const VertexAttribDivisor &vad, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
Definition VertexAttribDivisor:33
virtual Type getType() const
Return the Type identifier of the attribute's class type.
Definition VertexAttribDivisor:43
unsigned int getDivisor() const
Get the vertex attrib divisor.
Definition VertexAttribDivisor:72
virtual osg::Object * cloneType() const
Clone the type of an attribute, with Object* return type.
Definition VertexAttribDivisor:38
VertexAttribDivisor(unsigned int index, unsigned int divisor)
void setIndex(unsigned int index)
Set the vertex attrib index - the vertex attribute slot that the divisor should apply to.
Definition VertexAttribDivisor:63
virtual const char * className() const
Return the name of the attribute's class type.
Definition VertexAttribDivisor:42
unsigned int _divisor
Definition VertexAttribDivisor:82
unsigned int _index
Definition VertexAttribDivisor:81
virtual void apply(State &state) const
Apply to the OpenGL state machine.
virtual bool isSameKindAs(const osg::Object *obj) const
Return true if this and obj are of the same kind of object.
Definition VertexAttribDivisor:40
virtual const char * libraryName() const
Return the name of the attribute's library.
Definition VertexAttribDivisor:41
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.