H3D API  2.4.1
LineSet.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 __LINESET_H__
30 #define __LINESET_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 
72  class H3DAPI_API LineSet : public X3DGeometryNode {
73  public:
76 
81  Field,
84 
89  Field,
92 
95  typedef DependentSFNode<
98  Field,
101 
104 
107  class H3DAPI_API MFVertexAttributeNode : public DependentMFNode<
108  X3DVertexAttributeNode,
109  FieldRef< X3DGeometricPropertyNode,
110  Field,
111  &X3DVertexAttributeNode::propertyChanged > > {
112  };
113 
118  class H3DAPI_API DisplayList: public X3DGeometryNode::DisplayList {
119  public:
121  virtual void callList( bool build_list = true );
122  };
123 
125  LineSet( Inst< SFNode > _metadata = 0,
126  Inst< SFBound > _bound = 0,
127  Inst< DisplayList > _displayList = 0,
128  Inst< SFColorNode > _color = 0,
129  Inst< SFCoordinateNode > _coord = 0,
130  Inst< MFInt32 > _vertexCount = 0,
131  Inst< SFFogCoordinate > _fogCoord = 0,
132  Inst< MFVertexAttributeNode > _attrib = 0 );
133 
135  virtual int nrLines() {
136  X3DCoordinateNode *coord_node = coord->getValue();
137  if( coord_node ) {
138  unsigned int size = coord_node->nrAvailableCoords();
139  if( size > 1 )return size - 1;
140  }
141  return 0;
142  }
143 
145  virtual void render();
146 
147  // Traverse the scenegraph. See X3DGeometryNode::traverseSG
148  // for more info.
149  virtual void traverseSG( TraverseInfo &ti );
150 
159  H3DUniquePtr< SFColorNode > color;
160 
167  H3DUniquePtr< SFCoordinateNode > coord;
168 
178  H3DUniquePtr< MFInt32 > vertexCount;
179 
186  H3DUniquePtr< SFFogCoordinate > fogCoord;
187 
195  H3DUniquePtr< MFVertexAttributeNode > attrib;
196 
199 
200  protected:
207  };
208 }
209 
210 #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.
The CoordBoundField is specialized update itself from a X3DCoordinateNode.
Definition: CoordBoundField.h:43
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: LineSet.h:118
Thrown then vertexCount value is < 2.
Definition: LineSet.h:75
The MFVertexAttributeNode is dependent on the propertyChanged field of the contained X3DVertexAttribu...
Definition: LineSet.h:111
The LineSet node represents a 3D geometry formed by constructing polylines from 3D vertices specified...
Definition: LineSet.h:72
H3DUniquePtr< SFColorNode > color
The color field specifies the colour of the line set at each vertex and contains a X3DColorNode.
Definition: LineSet.h:159
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: LineSet.h:198
DependentSFNode< X3DColorNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DColorNode::propertyChanged > > SFColorNode
SFColorNode is dependent on colorChanged field in X3DColorNode.
Definition: LineSet.h:91
H3DUniquePtr< SFFogCoordinate > fogCoord
If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculatin...
Definition: LineSet.h:186
CoordBoundField SFBound
The bound field for LineSet is a CoordBoundField.
Definition: LineSet.h:103
H3DUniquePtr< MFInt32 > vertexCount
The vertexCount field describes how many vertices are to be used in each polyline from the coordinate...
Definition: LineSet.h:178
virtual int nrLines()
The number of lines rendered by this geometry.
Definition: LineSet.h:135
H3DUniquePtr< MFVertexAttributeNode > attrib
If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per...
Definition: LineSet.h:195
DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
SFCoordinateNode is dependent on coordChanged field in X3DCoordinateNode.
Definition: LineSet.h:83
bool render_patches
This will be set to true in traverseSG if the render function is supposed to render GL_PATCHES instea...
Definition: LineSet.h:206
H3DUniquePtr< SFCoordinateNode > coord
The coord field specifies the 3D vertices of the line set and contains a X3DCoordinateNode.
Definition: LineSet.h:167
DependentSFNode< FogCoordinate, FieldRef< X3DGeometricPropertyNode, Field, &FogCoordinate::propertyChanged > > SFFogCoordinate
The SFFogCoordinate is dependent on the propertyChanged field of the contained FogCoordinate.
Definition: LineSet.h:100
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
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
virtual unsigned int nrAvailableCoords()=0
Returns the number of coordinates this coordinate node can render.
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
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