H3D API  2.4.1
GeometryGroup.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 __GEOMETRYGROUP_H__
30 #define __GEOMETRYGROUP_H__
31 
32 #include <H3D/X3DGeometryNode.h>
33 #include <H3D/X3DBoundedObject.h>
35 
36 namespace H3D {
37 
50  class H3DAPI_API GeometryGroup : public X3DGeometryNode {
51  public:
52 
53  class H3DAPI_API MFGeometry :
54  public DependentMFNode< X3DGeometryNode,
55  FieldRef< H3DDisplayListObject,
56  H3DDisplayListObject::DisplayList,
57  &H3DDisplayListObject::displayList >,
58  true > {
59  public:
61  typedef DependentMFNode<
66  true > MFGeometryBase;
67 
71  ~MFGeometry() {
72  clear();
73  }
74 
76  virtual void onAdd( Node *n );
77 
79  virtual void onRemove( Node *n );
80 
81  private:
82  friend class X3DGeometryNode;
83  };
84 
94  class H3DAPI_API SFBound:
95  public TypedField< X3DBoundedObject::SFBound,
96  void,
97  AnyNumber< X3DBoundedObject::SFBound > > {
100  virtual void update();
101  };
102 
109  class H3DAPI_API IsTouched : public MFBool {
110  protected:
111  virtual void update();
112  };
113 
117  class H3DAPI_API MFVec3fPerIndex :
118  public TypedField< MFVec3f, MFVec3f, AnyNumber< MFVec3f > > {
119  public:
120  void unrouteAllFrom();
121  protected:
122  virtual void update();
123  };
124 
126  GeometryGroup( Inst< SFNode > _metadata = 0,
127  Inst< SFBound > _bound = 0,
128  Inst< DisplayList > _displayList = 0,
129  Inst< IsTouched > _isTouched = 0,
130  Inst< MFVec3fPerIndex > _force = 0,
131  Inst< MFVec3fPerIndex > _contactPoint = 0,
132  Inst< MFVec3fPerIndex > _contactNormal = 0,
133  Inst< MFVec3fPerIndex > _contactTexCoord = 0,
134  Inst< SFBoundTree > _boundTree = 0,
135  Inst< MFGeometry > _geometry = 0 );
136 
138  virtual int nrTriangles();
139 
141  virtual void render();
142 
144  virtual void traverseSG( TraverseInfo &ti );
145 
152  virtual bool lineIntersect(
153  const Vec3f &from,
154  const Vec3f &to,
155  LineIntersectResult &result );
156 
162  virtual void closestPoint( const Vec3f &p,
163  NodeIntersectResult &result );
164 
172  virtual bool movingSphereIntersect( H3DFloat radius,
173  const Vec3f &from,
174  const Vec3f &to,
175  NodeIntersectResult &result );
176 
177 
181  virtual bool supportsTangentAttributes();
182 
185  virtual void glRender();
186 
192  H3DUniquePtr< MFGeometry > geometry;
193 
196  };
197 }
198 
199 #endif
Contains the DependentSFNode and DependentMFNode template classes.
Header file for X3DBoundedObject.
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
Class used for specifying a field member of a node in a DependentSFNode or DependentMFNode specificat...
Definition: DependentNodeFields.h:48
Specialized field class which grabs the first true value for each index for any of the contained geom...
Definition: GeometryGroup.h:109
Specialized field class which gets one value from each routed field and stores that at the correspond...
Definition: GeometryGroup.h:118
SFBound is specialized to update from the SFBound fields routed to it.
Definition: GeometryGroup.h:97
The GeometryGroup node is treated by the scenegraph as one geometry but it can contain several geomet...
Definition: GeometryGroup.h:50
H3DUniquePtr< MFGeometry > geometry
The geometry nodes.
Definition: GeometryGroup.h:192
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: GeometryGroup.h:195
We use the Field's lazy evaluation mechanisms to manage the GL display lists for rendering,...
Definition: H3DDisplayListObject.h:60
This abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
H3DUniquePtr< DisplayList > displayList
The DisplayList instance handling the OpenGL caching of this object.
Definition: H3DDisplayListObject.h:256
The MFBool field contains a vector of boolean values.
Definition: MFBool.h:39
Node is the base class for all classes that can be part of the H3D scene-graph.
Definition: Node.h:46
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
A template modifier class for adding type checking on the routes to any Field class.
Definition: TypedField.h:84
This is the base node type for all geometry in X3D.
Definition: X3DGeometryNode.h:61
float H3DFloat
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
Used as input to lineIntersect functions.
Definition: Node.h:224
Used as input to intersection functions.
Definition: Node.h:114