H3D API  2.4.1
Switch.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 __SWITCH_H__
30 #define __SWITCH_H__
31 
32 #include <H3D/X3DGroupingNode.h>
33 #include <H3D/SFInt32.h>
34 
35 namespace H3D {
36 
67  class H3DAPI_API Switch : public X3DGroupingNode {
68  public:
69 
81  class H3DAPI_API SFBound:
82  public TypedField< X3DGroupingNode::SFBound,
83  SFInt32,
84  AnyNumber< X3DBoundedObject::SFBound > > {
87  virtual void update();
88  };
89 
91  Switch( Inst< AddChildren > _addChildren = 0,
92  Inst< RemoveChildren > _removeChildren = 0,
93  Inst< MFChild > _children = 0,
94  Inst< SFNode > _metadata = 0,
95  Inst< SFBound > _bound = 0,
96  Inst< SFVec3f > _bboxCenter = 0,
97  Inst< SFVec3f > _bboxSize = 0,
98  Inst< SFInt32 > _whichChoice = 0 );
99 
101  virtual void render();
102 
104  virtual void traverseSG( TraverseInfo &ti );
105 
114  virtual bool lineIntersect(
115  const Vec3f &from,
116  const Vec3f &to,
117  LineIntersectResult &result );
118 
125  virtual void closestPoint( const Vec3f &p,
126  NodeIntersectResult &result );
127 
137  virtual bool movingSphereIntersect( H3DFloat radius,
138  const Vec3f &from,
139  const Vec3f &to,
140  NodeIntersectResult &result );
141 
151  H3DUniquePtr< SFInt32 > whichChoice;
152 
155  };
156 }
157 
158 #endif
Contains the SFInt32 field class.
Header file for X3DGroupingNode, X3D scene-graph node.
SFBound is specialized to update from the SFBound fields routed to it.
Definition: Switch.h:84
The Switch grouping node traverses zero or one of the nodes specified in the choice field.
Definition: Switch.h:67
H3DUniquePtr< SFInt32 > whichChoice
The whichChoice field specifies the index of the child to traverse, with the first child having index...
Definition: Switch.h:151
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: Switch.h:154
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 abstract node type indicates that concrete node types derived from it contain children nodes and...
Definition: X3DGroupingNode.h:53
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