H3D API  2.4.1
Coordinate.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 __COORDINATE_H__
30 #define __COORDINATE_H__
31 
32 #include <H3D/X3DCoordinateNode.h>
33 #include <H3D/FieldTemplates.h>
34 #include <GL/glew.h>
35 #include <H3D/MFVec3f.h>
36 #include <H3D/SFBool.h>
37 
38 namespace H3D {
39 
50  class H3DAPI_API Coordinate : public X3DCoordinateNode {
51  public:
53  Coordinate( Inst< SFNode > _metadata = 0,
54  Inst< MFVec3f > _point = 0);
55 
57  virtual ~Coordinate();
58 
61  virtual void render( int index ) {
62  const Vec3f &v = point->getValueByIndex( index );
63  glVertex3f( v.x, v.y, v.z );
64  };
65 
68  virtual void renderArray();
69 
71  virtual void disableArray();
72 
73  // Gets the coordinate of a given index.
74  virtual Vec3f getCoord( int index ){
75  return point->getValueByIndex( index );
76  }
77 
79  virtual unsigned int nrAvailableCoords() {
80  return point->size();
81  };
82 
84  virtual void setAttributeData ( );
85 
87  virtual void renderVBO ( );
88 
90  virtual void disableVBO ( );
91 
93  virtual bool preRenderCheckFail ( );
94 
99  H3DUniquePtr< MFVec3f > point;
100 
103 
104  };
105 }
106 
107 #endif
Contains different templates to modify field behaviour.
Contains the MFVec3f field class.
Contains the SFBool field class.
Header file for X3DCoordinateNode, X3D scene-graph node.
This node defines a set of 3D coordinates to be used in the coord field of vertex-based geometry node...
Definition: Coordinate.h:50
virtual void render(int index)
Perform the OpenGL commands to render a vertex given the index of the vertex.
Definition: Coordinate.h:61
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Coordinate.h:102
H3DUniquePtr< MFVec3f > point
A vector of Vec3f defining points in 3d-space.
Definition: Coordinate.h:99
virtual unsigned int nrAvailableCoords()
Returns the number of coordinates this coordinate node can render.
Definition: Coordinate.h:79
This is the base node type for all coordinate node types in X3D.
Definition: X3DCoordinateNode.h:47
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