H3D API  2.4.1
HAnimHumanoid.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 __HANIMHUMANOID_H__
30 #define __HANIMHUMANOID_H__
31 
32 #include <H3D/X3DChildNode.h>
33 #include <H3D/X3DBoundedObject.h>
34 #include <H3D/X3DCoordinateNode.h>
35 #include <H3D/X3DNormalNode.h>
38 #include <H3D/Transform.h>
39 #include <H3D/SFRotation.h>
40 #include <H3D/MFString.h>
41 #include <H3D/HAnimJoint.h>
42 #include <H3D/HAnimSite.h>
43 
44 namespace H3D {
45 
64  class H3DAPI_API HAnimHumanoid :
65  public X3DChildNode,
66  public X3DBoundedObject,
67  public H3DDisplayListObject {
68  public:
69 
70  class MFJoint : public MFNode {
71  virtual void onAdd( Node * );
72  virtual void onRemove( Node * );
73  };
74 
75  typedef MFNode MFSegment;
76  typedef MFNode MFSite;
77 
78  class MFSkeletonNode: public MFNode {
79  virtual void onAdd( Node * );
80  };
81 
82  typedef MFNode MFChild;
83 
88  Field,
91 
96  Field,
99 
101  HAnimHumanoid( Inst< SFNode > _metadata = 0,
102  Inst< SFBound > _bound = 0,
103  Inst< SFVec3f > _bboxCenter = 0,
104  Inst< SFVec3f > _bboxSize = 0,
105  Inst< MFString > _info = 0,
106  Inst< SFString > _name = 0,
107  Inst< SFString > _version = 0,
108  Inst< MFChild > _skin = 0,
109  Inst< MFJoint > _joints = 0,
110  Inst< MFSegment > _segments = 0,
111  Inst< MFSite > _sites = 0,
112  Inst< MFSkeletonNode > _skeleton = 0,
113  Inst< MFSite > _viewpoints = 0,
114  Inst< SFCoordinateNode > _skinCoord = 0,
115  Inst< SFNormalNode > _skinNormal = 0,
116  Inst< SFVec3f > _center = 0,
117  Inst< SFRotation > _rotation = 0,
118  Inst< SFVec3f > _scale = 0,
119  Inst< SFRotation > _scaleOrientation = 0,
120  Inst< SFVec3f > _translation = 0,
121  Inst< SFString > _renderMode = 0
122  );
123 
125  virtual void initialize();
126 
128  virtual void render();
129 
131  virtual void traverseSG( TraverseInfo &ti );
132 
140  virtual bool lineIntersect(
141  const Vec3f &from,
142  const Vec3f &to,
143  LineIntersectResult &result );
144 
151  virtual void closestPoint( const Vec3f &p,
152  NodeIntersectResult &result );
153 
162  virtual bool movingSphereIntersect( H3DFloat radius,
163  const Vec3f &from,
164  const Vec3f &to,
165  NodeIntersectResult &result );
166 
170 
198  H3DUniquePtr< MFString > info;
199 
207  H3DUniquePtr< SFString > name;
208 
216  H3DUniquePtr< SFString > version;
217 
227  H3DUniquePtr< MFChild > skin;
228 
238  H3DUniquePtr< MFJoint > joints;
239 
249  H3DUniquePtr< MFSegment > segments;
250 
260  H3DUniquePtr< MFSite > sites;
261 
278  H3DUniquePtr< MFSkeletonNode > skeleton;
279 
297  H3DUniquePtr< MFSite > viewpoints;
298 
308  H3DUniquePtr< SFCoordinateNode > skinCoord;
309 
319  H3DUniquePtr< SFNormalNode > skinNormal;
320 
328  H3DUniquePtr< SFVec3f > center;
329 
337  H3DUniquePtr< SFRotation > rotation;
338 
346  H3DUniquePtr< SFVec3f > scale;
347 
356  H3DUniquePtr< SFRotation > scaleOrientation;
357 
365  H3DUniquePtr< SFVec3f > translation;
366 
381  H3DUniquePtr< SFString > renderMode;
382 
385 
386  protected:
387 
397  template< class VectorType >
398  void updateCoordinates( const VectorType &orig_points,
399  const vector< Vec3f > &orig_normals,
400  VectorType &modified_points,
401  vector< Vec3f > &modified_normals );
402 
411  template< class VectorType >
412  void updateCoordinatesLBS( const VectorType &orig_points,
413  const vector< Vec3f > &orig_normals,
414  VectorType &modified_points,
415  vector< Vec3f > &modified_normals );
416 
426  template< class VectorType >
427  void updateCoordinatesLBS2( const VectorType &orig_points,
428  const vector< Vec3f > &orig_normals,
429  VectorType &modified_points,
430  vector< Vec3f > &modified_normals );
431 
440  template< class VectorType >
441  void updateCoordinatesDLB( const VectorType &orig_points,
442  const vector< Vec3f > &orig_normals,
443  VectorType &modified_points,
444  vector< Vec3f > &modified_normals );
445 
449 
452  vector< Vec3d > points_double;
453 
456  vector< Vec3f > points_single;
457 
460  vector< Vec3f > normals_single;
461 
465 
469 
473  H3DUniquePtr< Field > jointMatrixChanged;
474  };
475 }
476 
477 #endif
Contains the DependentSFNode and DependentMFNode template classes.
Header file for H3DDisplayListObject.
Header file for HAnimJoint, X3D scene-graph node.
Header file for HAnimSite, X3D scene-graph node.
Contains the MFString field class.
Contains the SFRotation field class.
Header file for Transform, X3D scene-graph node.
Header file for X3DBoundedObject.
Header file for X3DChildNode, X3D scene-graph node.
Header file for X3DCoordinateNode, X3D scene-graph node.
Header file for X3DNormalNode, X3D scene-graph node.
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 abstract interface class is the base class for all node types that wants to create an OpenGL dis...
Definition: H3DDisplayListObject.h:54
The HAnimHumanoid node is a container for the entire humanoid.
Definition: HAnimHumanoid.h:67
H3DUniquePtr< MFSite > sites
The sites field contains a list of references, one for each HAnimSite object defined within the skele...
Definition: HAnimHumanoid.h:260
H3DUniquePtr< SFString > version
The version field stores the version of the H-Anim International Standard to which the Humanoid objec...
Definition: HAnimHumanoid.h:216
vector< Vec3d > points_double
vector for storing the original points before joint and displacer modification if the original coord ...
Definition: HAnimHumanoid.h:452
DependentSFNode< X3DNormalNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DNormalNode::propertyChanged > > SFNormalNode
The SFNormalNode is dependent on the propertyChanged field of the
Definition: HAnimHumanoid.h:98
H3DUniquePtr< SFRotation > scaleOrientation
The scaleOrientation specifies a rotation of the coordinate system of the humanoid figure before the ...
Definition: HAnimHumanoid.h:356
AutoRef< X3DNormalNode > current_normal
The normal node that was used as base normals in last traverseSG.
Definition: HAnimHumanoid.h:468
H3DUniquePtr< SFVec3f > scale
The scale field specifies a non-uniform scale of the humanoid figure coordinate system and the scale ...
Definition: HAnimHumanoid.h:346
AutoRef< X3DCoordinateNode > current_coordinate
The coordinate node that was used as base coordinate in last traverseSG.
Definition: HAnimHumanoid.h:464
H3DUniquePtr< MFString > info
The info field consists of a sequence of strings, each of which is of the form "tag=value".
Definition: HAnimHumanoid.h:198
DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
The SFCoordinateNode is dependent on the propertyChanged field of the contained X3DCoordinateNode.
Definition: HAnimHumanoid.h:90
H3DUniquePtr< Field > jointMatrixChanged
Field used to know if any values have changed so that the coordinates have to be updated.
Definition: HAnimHumanoid.h:473
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: HAnimHumanoid.h:384
H3DUniquePtr< MFSkeletonNode > skeleton
The skeleton field contains the HAnimHumanoid root HAnimJoint object.
Definition: HAnimHumanoid.h:278
H3DUniquePtr< SFVec3f > translation
The translation field specifies a translation to the coordinate system of the entire humanoid figure.
Definition: HAnimHumanoid.h:365
H3DUniquePtr< MFChild > skin
The skin field contains the nodes that define the graphical appearance of the HAnimHumanoid.
Definition: HAnimHumanoid.h:227
vector< Vec3f > points_single
vector for storing the original points before joint and displacer modification if the original coord ...
Definition: HAnimHumanoid.h:456
H3DUniquePtr< MFSegment > segments
The segments field contains a list of references, one for each HAnimSegment object defined within the...
Definition: HAnimHumanoid.h:249
H3DUniquePtr< SFNormalNode > skinNormal
The skinNormal field contains the normal data definition which is used by the internal mechanisms of ...
Definition: HAnimHumanoid.h:319
H3DUniquePtr< SFString > renderMode
The renderMode field defines how the humanoid should be rendered.
Definition: HAnimHumanoid.h:381
H3DUniquePtr< SFString > name
The name field stores the name of the humanoid defined by the Humanoid object.
Definition: HAnimHumanoid.h:207
H3DUniquePtr< SFCoordinateNode > skinCoord
The skinCoord field contains a single sequence of points which are used by the internal mechanisms of...
Definition: HAnimHumanoid.h:308
vector< Vec3f > normals_single
vector for storing the original normals before joint and displacer modification if the original norma...
Definition: HAnimHumanoid.h:460
H3DUniquePtr< MFSite > viewpoints
The viewpoints field has a different functionality and behaviour than the joints, segments and sites ...
Definition: HAnimHumanoid.h:297
H3DUniquePtr< SFRotation > rotation
The rotation field specifies a rotation of the coordinate system of the humanoid figure.
Definition: HAnimHumanoid.h:337
H3DUniquePtr< MFJoint > joints
The joints field contains a list of references, one for each HAnimJoint object defined within the ske...
Definition: HAnimHumanoid.h:238
AutoRef< Transform > root_transform
Transform node that will contain the skin nodes and which values will be controlled by the transforma...
Definition: HAnimHumanoid.h:448
bool use_union_bound
if true a route will be set up between the bound field of the nodes in skin and the bound field of th...
Definition: HAnimHumanoid.h:169
H3DUniquePtr< SFVec3f > center
The center field specifies a translation offset from the origin of the local coordinate system (0,...
Definition: HAnimHumanoid.h:328
MFNode is almost like any MField but it encapsulates a vector of Node pointers.
Definition: MFNode.h:44
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
This X3D abstract interface type is basis for all X3D node types that have bounds specified as part o...
Definition: X3DBoundedObject.h:46
This abstract node type indicates that the concrete nodes which are instantiated based on it may be u...
Definition: X3DChildNode.h:42
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
This is the base node type for all normal node types in X3D.
Definition: X3DNormalNode.h:45
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