H3D API  2.4.1
CoordinateDouble.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 __COORDINATEDOUBLE_H__
30 #define __COORDINATEDOUBLE_H__
31 
32 #include <H3D/X3DCoordinateNode.h>
33 #include <H3D/FieldTemplates.h>
34 #include <GL/glew.h>
35 #include <H3D/MFVec3d.h>
36 #include <H3D/SFBool.h>
37 
38 namespace H3D {
39 
52  class H3DAPI_API CoordinateDouble : public X3DCoordinateNode {
53  public:
55  CoordinateDouble( Inst< SFNode > _metadata = 0,
56  Inst< MFVec3d > _point = 0);
57 
59  virtual ~CoordinateDouble();
60 
63  virtual void render( int index ) {
64  const Vec3d &v = point->getValueByIndex( index );
65  glVertex3d( v.x, v.y, v.z );
66  };
67 
70  virtual void renderArray();
71 
73  virtual void disableArray();
74 
75  // Gets the coordinate of a given index.
76  virtual Vec3f getCoord( int index ){
77  return Vec3f( point->getValueByIndex( index ) );
78  }
79 
81  virtual unsigned int nrAvailableCoords() {
82  return point->size();
83  };
84 
86  virtual void setAttributeData ( );
87 
89  virtual void renderVBO ( );
90 
92  virtual void disableVBO ( );
93 
95  virtual bool preRenderCheckFail ( );
96 
101  H3DUniquePtr< MFVec3d > point;
102 
105 
106  };
107 }
108 
109 #endif
Contains different templates to modify field behaviour.
Contains the MFVec3d 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: CoordinateDouble.h:52
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: CoordinateDouble.h:104
virtual unsigned int nrAvailableCoords()
Returns the number of coordinates this coordinate node can render.
Definition: CoordinateDouble.h:81
H3DUniquePtr< MFVec3d > point
A vector of Vec3d defining points in 3d-space.
Definition: CoordinateDouble.h:101
virtual void render(int index)
Perform the OpenGL commands to render a vertex given the index of the vertex.
Definition: CoordinateDouble.h:63
This is the base node type for all coordinate node types in X3D.
Definition: X3DCoordinateNode.h:47
Vec3d()
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