H3D API  2.4.1
IndexedLineSet.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 __INDEXEDLINESET_H__
30 #define __INDEXEDLINESET_H__
31 
32 #include <H3D/X3DGeometryNode.h>
34 #include <H3D/X3DCoordinateNode.h>
35 #include <H3D/X3DColorNode.h>
36 #include <H3D/CoordBoundField.h>
37 #include <H3D/MFInt32.h>
38 #include <H3D/FogCoordinate.h>
39 
40 namespace H3D {
41 
111  class H3DAPI_API IndexedLineSet : public X3DGeometryNode {
112  public:
116 
120 
125  Field,
128 
131  typedef DependentSFNode< X3DColorNode,
133  Field,
136 
139  typedef DependentSFNode<
142  Field,
145 
148  class H3DAPI_API MFVertexAttributeNode : public DependentMFNode<
149  X3DVertexAttributeNode,
150  FieldRef< X3DGeometricPropertyNode,
151  Field,
152  &X3DVertexAttributeNode::propertyChanged > > {
153  };
154 
159  class H3DAPI_API DisplayList: public X3DGeometryNode::DisplayList {
160  public:
162  virtual void callList( bool build_list = true );
163  };
164 
166  IndexedLineSet( Inst< SFNode > _metadata = 0,
167  Inst< CoordBoundField > _bound = 0,
168  Inst< DisplayList > _displayList = 0,
169  Inst< MFInt32 > _set_colorIndex = 0,
170  Inst< MFInt32 > _set_coordIndex = 0,
171  Inst< SFColorNode > _color = 0,
172  Inst< SFCoordinateNode > _coord = 0,
173  Inst< MFInt32 > _colorIndex = 0,
174  Inst< SFBool > _colorPerVertex = 0,
175  Inst< MFInt32 > _coordIndex = 0,
176  Inst< SFFogCoordinate > _fogCoord = 0,
177  Inst< MFVertexAttributeNode > _attrib = 0 );
178 
179  ~IndexedLineSet();
180 
182  virtual int nrLines() {
183  unsigned int size = coordIndex->size();
184  if( size > 1 )return size - 1;
185  else return 0;
186  }
187 
189  virtual void render();
190 
198  virtual bool movingSphereIntersect( H3DFloat radius,
199  const Vec3f &from,
200  const Vec3f &to,
201  NodeIntersectResult &result );
202 
207  H3DUniquePtr< MFInt32 > set_colorIndex;
208 
213  H3DUniquePtr< MFInt32 > set_coordIndex;
214 
224  H3DUniquePtr< SFColorNode > color;
225 
231  H3DUniquePtr< SFCoordinateNode > coord;
232 
241  H3DUniquePtr< MFInt32 > colorIndex;
242 
250  H3DUniquePtr< SFBool > colorPerVertex;
251 
260  H3DUniquePtr< MFInt32 > coordIndex;
261 
268  H3DUniquePtr< SFFogCoordinate > fogCoord;
269 
277  H3DUniquePtr< MFVertexAttributeNode > attrib;
278 
281  protected:
284  H3DUniquePtr< Field > vboFieldsUpToDate;
285  // The index for the vertex buffer object
286  GLuint *vbo_id;
287  vector< pair< GLsizei, pair< GLsizei, GLsizei > > > nr_index;
288  };
289 }
290 
291 #endif
Header file for CoordBoundField, specialiced field class.
Contains the DependentSFNode and DependentMFNode template classes.
Header file for FogCoordinate.
Contains the MFInt32 field class.
Header file for X3DColorNode, X3D scene-graph node.
Header file for X3DCoordinateNode, X3D scene-graph node.
Header file for X3DGeometryNode, X3D scene-graph node.
DependentMFNode are modified TypedMFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:336
DependentSFNode are modified TypedSFNode fields where the field dirty status is dependent on fields i...
Definition: DependentNodeFields.h:294
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
The Field class.
Definition: Field.h:46
This node defines a set of explicit fog depths on a per-vertex basis.
Definition: FogCoordinate.h:65
Display list is extended in order to set color to emissive color from material outside of display lis...
Definition: IndexedLineSet.h:159
Thrown when the colorIndex field's size does not match the coordIndex field properly.
Definition: IndexedLineSet.h:119
Thrown when the colorIndex field does not match the coordIndex field properly.
Definition: IndexedLineSet.h:115
The MFVertexAttributeNode is dependent on the propertyChanged field of the contained X3DVertexAttribu...
Definition: IndexedLineSet.h:152
The IndexedLineSet node represents a 3D geometry formed by constructing polylines from 3D vertices sp...
Definition: IndexedLineSet.h:111
H3DUniquePtr< MFInt32 > colorIndex
Indices into the color field.
Definition: IndexedLineSet.h:241
static H3DNodeDatabase database
The H3DNodeDatabase instance for this node.
Definition: IndexedLineSet.h:280
H3DUniquePtr< MFInt32 > coordIndex
Indices into the coord field.
Definition: IndexedLineSet.h:260
H3DUniquePtr< Field > vboFieldsUpToDate
Internal field used to know if vertex buffer object can be created.
Definition: IndexedLineSet.h:284
H3DUniquePtr< SFBool > colorPerVertex
If TRUE the colors in the color field are applied per vertex, otherwise it is applied per polyline.
Definition: IndexedLineSet.h:250
virtual int nrLines()
The number of lines rendered by this geometry.
Definition: IndexedLineSet.h:182
H3DUniquePtr< SFColorNode > color
Contains an X3DColorNode which colors are applied to the X3DComposedGeometryNode.
Definition: IndexedLineSet.h:224
H3DUniquePtr< MFInt32 > set_coordIndex
Field for setting the value of the coordIndex field.
Definition: IndexedLineSet.h:213
H3DUniquePtr< MFVertexAttributeNode > attrib
If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per...
Definition: IndexedLineSet.h:277
DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
SFCoordinateNode is dependent on coordChanged field in X3DCoordinateNode.
Definition: IndexedLineSet.h:127
H3DUniquePtr< MFInt32 > set_colorIndex
Field for setting the value of the colorIndex field.
Definition: IndexedLineSet.h:207
DependentSFNode< FogCoordinate, FieldRef< X3DGeometricPropertyNode, Field, &FogCoordinate::propertyChanged > > SFFogCoordinate
The SFFogCoordinate is dependent on the propertyChanged field of the contained FogCoordinate.
Definition: IndexedLineSet.h:144
H3DUniquePtr< SFCoordinateNode > coord
The coord field specifies the 3D vertices of the line set and contains a X3DCoordinateNode.
Definition: IndexedLineSet.h:231
H3DUniquePtr< SFFogCoordinate > fogCoord
If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculatin...
Definition: IndexedLineSet.h:268
DependentSFNode< X3DColorNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DColorNode::propertyChanged > > SFColorNode
SFColorNode is dependent on colorChanged field in X3DColorNode.
Definition: IndexedLineSet.h:135
This is the base node type for color specifications in X3D.
Definition: X3DColorNode.h:44
This is the base node type for all coordinate node types in X3D.
Definition: X3DCoordinateNode.h:47
This is the base node type for all geometric property node types defined in X3D.
Definition: X3DGeometricPropertyNode.h:43
H3DUniquePtr< Field > propertyChanged
Field that indicated whether the properties have changed.
Definition: X3DGeometricPropertyNode.h:53
Display list is extended in order to set front sidedness of triangles outside the display list.
Definition: X3DGeometryNode.h:76
This is the base node type for all geometry in X3D.
Definition: X3DGeometryNode.h:61
float H3DFloat
H3D_VALUE_EXCEPTION(string, InvalidType)
An exception thrown when a field is of the wrong type when it is checked.
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