H3D API  2.4.1
X3DVertexAttributeNode.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __X3DVERTEXATTRIBUTENODE_H__
30 #define __X3DVERTEXATTRIBUTENODE_H__
31 
34 #include <H3D/SFString.h>
35 #include <H3D/SFInt32.h>
36 
37 namespace H3D {
45  class H3DAPI_API X3DVertexAttributeNode:
48  public:
50  X3DVertexAttributeNode( Inst< SFNode > _metadata = 0,
51  Inst< SFString > _name = 0,
52  Inst< SFInt32 > _divisor = 0 );
53 
59  virtual void render( int /*value_index*/ ){}
60 
64  virtual void renderArray() {}
65 
67  virtual void disableArray() {}
68 
72  inline void setAttribIndex( int _attrib_index ) {
73  attrib_index = _attrib_index;
74  }
75 
77  virtual void setAttributeData ( ){};
78 
80  virtual void renderVBO ( ){};
81 
83  virtual void disableVBO ( ){};
84 
87  virtual string defaultXMLContainerField() {
88  return "attrib";
89  }
90 
96  H3DUniquePtr< SFString > name;
97 
103  H3DUniquePtr< SFInt32 > divisor;
104 
107 
108  protected:
109  int attrib_index;
110  };
111 }
112 
113 #endif
114 
115 
116 
117 
118 
119 
Contains the GLVertexAttributeObject class.
Contains the SFInt32 field class.
Contains the SFString field class.
Header file for X3DGeometricPropertyNode, X3D scene-graph node.
This abstract interface is inherited by all nodes that could be used as vertex attributes in a glsl s...
Definition: GLVertexAttributeObject.h:54
This is the base node type for all geometric property node types defined in X3D.
Definition: X3DGeometricPropertyNode.h:43
This abstract node type is the base type for all node types that specify per-vertex attribute informa...
Definition: X3DVertexAttributeNode.h:47
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: X3DVertexAttributeNode.h:106
H3DUniquePtr< SFString > name
The name field describes a name that is mapped to the shading language-specific name for describing p...
Definition: X3DVertexAttributeNode.h:96
virtual string defaultXMLContainerField()
Returns the default xml containerField attribute value.
Definition: X3DVertexAttributeNode.h:87
virtual void setAttributeData()
Implement the method to specify data and releated information.
Definition: X3DVertexAttributeNode.h:77
virtual void renderVBO()
VBO rendering implementation.
Definition: X3DVertexAttributeNode.h:80
virtual void renderArray()
Perform the OpenGL commands to set the vertex attributes as a an vertex attribute array on the attrib...
Definition: X3DVertexAttributeNode.h:64
virtual void render(int)
Perform the OpenGL commands to set the vertex attribute with the given index.
Definition: X3DVertexAttributeNode.h:59
H3DUniquePtr< SFInt32 > divisor
If non-zero, for instanced rendering, the divisor specifies the number of instances that will pass be...
Definition: X3DVertexAttributeNode.h:103
virtual void disableVBO()
VBO disabling implementation.
Definition: X3DVertexAttributeNode.h:83
void setAttribIndex(int _attrib_index)
Set the attribute index this vertex attribute should be rendered as.
Definition: X3DVertexAttributeNode.h:72
virtual void disableArray()
Disable the array state enabled in renderArray().
Definition: X3DVertexAttributeNode.h:67
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194