H3D API  2.4.1
PointSet.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 __POINTSET_H__
30 #define __POINTSET_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/FogCoordinate.h>
38 
39 namespace H3D {
40 
71  class H3DAPI_API PointSet : public X3DGeometryNode {
72  public:
73 
77 
82  Field,
85 
90  Field,
93 
96  typedef DependentSFNode<
99  Field,
102 
105 
108  class H3DAPI_API MFVertexAttributeNode : public DependentMFNode<
109  X3DVertexAttributeNode,
110  FieldRef< X3DGeometricPropertyNode,
111  Field,
112  &X3DVertexAttributeNode::propertyChanged > > {
113  };
114 
119  class H3DAPI_API DisplayList: public X3DGeometryNode::DisplayList {
120  public:
122  virtual void callList( bool build_list = true );
123  };
124 
126  PointSet( Inst< SFNode > _metadata = 0,
127  Inst< SFBound > _bound = 0,
128  Inst< DisplayList > _displayList = 0,
129  Inst< SFColorNode > _color = 0,
130  Inst< SFCoordinateNode > _coord = 0,
131  Inst< SFFogCoordinate > _fogCoord = 0,
132  Inst< MFVertexAttributeNode > _attrib = 0,
133  Inst< SFFloat > _pointSize = 0);
134 
136  virtual void render();
137 
139  virtual int nrPoints() {
140  X3DCoordinateNode *coord_node = coord->getValue();
141  if( coord_node ) {
142  unsigned int size = coord_node->nrAvailableCoords();
143  if( size > 1 )return size - 1;
144  }
145  return 0;
146  }
147 
155  virtual bool movingSphereIntersect( H3DFloat radius,
156  const Vec3f &from,
157  const Vec3f &to,
158  NodeIntersectResult &result );
159 
170  H3DUniquePtr< SFColorNode > color;
171 
179  H3DUniquePtr< SFCoordinateNode > coord;
180 
181 
188  H3DUniquePtr< SFFogCoordinate > fogCoord;
189 
197  H3DUniquePtr< MFVertexAttributeNode > attrib;
198 
203  H3DUniquePtr< SFFloat > pointSize;
204 
207  };
208 }
209 
210 #endif
Header file for CoordBoundField, specialiced field class.
Contains the DependentSFNode and DependentMFNode template classes.
Header file for FogCoordinate.
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: PointSet.h:119
The MFVertexAttributeNode is dependent on the propertyChanged field of the contained X3DVertexAttribu...
Definition: PointSet.h:112
Thrown when the number of colors in the color field are less than the number of points in the coord f...
Definition: PointSet.h:76
The PointSet node specifies a set of 3D points, in the local coordinate system, with associated colou...
Definition: PointSet.h:71
DependentSFNode< X3DColorNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DColorNode::propertyChanged > > SFColorNode
SFColorNode is dependent on colorChanged field in X3DColorNode.
Definition: PointSet.h:92
virtual int nrPoints()
The number of points rendered by this geometry.
Definition: PointSet.h:139
H3DUniquePtr< SFFloat > pointSize
point size Access type: inputOutput Default value: 1
Definition: PointSet.h:203
H3DUniquePtr< SFFogCoordinate > fogCoord
If the fogCoord field is not empty, it shall contain a list of per-vertex depth values for calculatin...
Definition: PointSet.h:188
DependentSFNode< FogCoordinate, FieldRef< X3DGeometricPropertyNode, Field, &FogCoordinate::propertyChanged > > SFFogCoordinate
The SFFogCoordinate is dependent on the propertyChanged field of the contained FogCoordinate.
Definition: PointSet.h:101
H3DUniquePtr< SFCoordinateNode > coord
The coord field specifies a X3DCoordinateNode.
Definition: PointSet.h:179
H3DUniquePtr< SFColorNode > color
If the color field is not NULL, it shall specify a Color node that contains at least the number of po...
Definition: PointSet.h:170
DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
SFCoordinateNode is dependent on coordChanged field in X3DCoordinateNode.
Definition: PointSet.h:84
H3DUniquePtr< MFVertexAttributeNode > attrib
If the attrib field is not empty it shall contain a list of X3DVertexAttributeNode instances with per...
Definition: PointSet.h:197
CoordBoundField SFBound
The bound field for PointSet is a CoordBoundField.
Definition: PointSet.h:104
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: PointSet.h:206
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
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