H3D API  2.4.1
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
H3D::HAnimHumanoid Class Reference

The HAnimHumanoid node is a container for the entire humanoid. More...

#include <H3D/HAnimHumanoid.h>

Inheritance diagram for H3D::HAnimHumanoid:
Inheritance graph

Public Types

typedef DependentSFNode< X3DCoordinateNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DCoordinateNode::propertyChanged > > SFCoordinateNode
 The SFCoordinateNode is dependent on the propertyChanged field of the contained X3DCoordinateNode.
 
typedef DependentSFNode< X3DNormalNode, FieldRef< X3DGeometricPropertyNode, Field, &X3DNormalNode::propertyChanged > > SFNormalNode
 The SFNormalNode is dependent on the propertyChanged field of the
More...
 
- Public Types inherited from H3D::Node
typedef std::map< Node *, Node * > DeepCopyMap
 A map type used during a deep copy clone() to map from original nodes to cloned nodes.
 

Public Member Functions

 HAnimHumanoid (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< SFVec3f > _bboxCenter=0, Inst< SFVec3f > _bboxSize=0, Inst< MFString > _info=0, Inst< SFString > _name=0, Inst< SFString > _version=0, Inst< MFChild > _skin=0, Inst< MFJoint > _joints=0, Inst< MFSegment > _segments=0, Inst< MFSite > _sites=0, Inst< MFSkeletonNode > _skeleton=0, Inst< MFSite > _viewpoints=0, Inst< SFCoordinateNode > _skinCoord=0, Inst< SFNormalNode > _skinNormal=0, Inst< SFVec3f > _center=0, Inst< SFRotation > _rotation=0, Inst< SFVec3f > _scale=0, Inst< SFRotation > _scaleOrientation=0, Inst< SFVec3f > _translation=0, Inst< SFString > _renderMode=0)
 Constructor.
 
virtual void initialize ()
 Initializes the root_transform.
 
virtual void render ()
 Render the skin.
 
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph. traverseSG() is called in all skin nodes.
 
virtual bool lineIntersect (const Vec3f &from, const Vec3f &to, LineIntersectResult &result)
 Detect intersection between a line segment and a Node. More...
 
virtual void closestPoint (const Vec3f &p, NodeIntersectResult &result)
 Find closest point on Node to p. More...
 
virtual bool movingSphereIntersect (H3DFloat radius, const Vec3f &from, const Vec3f &to, NodeIntersectResult &result)
 Detect collision between a moving sphere and the Node. More...
 
- Public Member Functions inherited from H3D::X3DChildNode
 X3DChildNode (Inst< SFNode > _metadata=0)
 Constructor.
 
- Public Member Functions inherited from H3D::X3DNode
 X3DNode (Inst< SFNode > _metadata=0)
 Constructor.
 
X3DMetadataObjectgetMetadataByName (const string &_name)
 Given a name, the first X3DMetadataObject in the metadata field that matches that name is returned. More...
 
- Public Member Functions inherited from H3D::Node
 Node ()
 Constructor.
 
virtual Nodeclone (bool deepCopy=true, DeepCopyMap *deepCopyMap=NULL)
 Returns a new instance of this node type with the same state as this one. More...
 
virtual ~Node ()
 Destructor.
 
X3DPrototypeInstancegetProtoInstanceParent ()
 If this node is the root node in the proto body of a X3DPrototypeInstance then this will return that node. More...
 
void setProtoInstanceParent (X3DPrototypeInstance *p)
 Set the X3DPrototypeInstance this node is the the root node if applicaple.
 
virtual string defaultXMLContainerField ()
 Returns the default xml containerField attribute value. More...
 
virtual FieldgetField (const string &_name) const
 return a pointer to the field specified by name within this instance
 
int addDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
int removeDestructCallback (void(*func)(Node *, void *), void *args)
 Add a callback function to be run on destruction of node. More...
 
- Public Member Functions inherited from H3D::H3DBoundedObject
 H3DBoundedObject (Inst< SFBound > _bound=0)
 Constructor.
 
- Public Member Functions inherited from H3D::H3DDisplayListObject
 H3DDisplayListObject (Inst< DisplayList > _displayList=0)
 Constructor.
 

Public Attributes

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 the grouping node. More...
 
H3DUniquePtr< MFStringinfo
 The info field consists of a sequence of strings, each of which is of the form "tag=value". More...
 
H3DUniquePtr< SFStringname
 The name field stores the name of the humanoid defined by the Humanoid object. More...
 
H3DUniquePtr< SFStringversion
 The version field stores the version of the H-Anim International Standard to which the Humanoid object conforms. More...
 
H3DUniquePtr< MFChildskin
 The skin field contains the nodes that define the graphical appearance of the HAnimHumanoid. More...
 
H3DUniquePtr< MFJoint > joints
 The joints field contains a list of references, one for each HAnimJoint object defined within the skeleton field hierarchy of the HAnimHumanoid object. More...
 
H3DUniquePtr< MFSegmentsegments
 The segments field contains a list of references, one for each HAnimSegment object defined within the skeleton field hierarchy of the Humanoid object. More...
 
H3DUniquePtr< MFSitesites
 The sites field contains a list of references, one for each HAnimSite object defined within the skeleton field hierarchy of the Humanoid object. More...
 
H3DUniquePtr< MFSkeletonNode > skeleton
 The skeleton field contains the HAnimHumanoid root HAnimJoint object. More...
 
H3DUniquePtr< MFSiteviewpoints
 The viewpoints field has a different functionality and behaviour than the joints, segments and sites fields. More...
 
H3DUniquePtr< SFCoordinateNodeskinCoord
 The skinCoord field contains a single sequence of points which are used by the internal mechanisms of the HAnimHumanoid object to create the appropriate surface deformations as well as by the indexed face set definitions within the skin field which do the actual rendering of the surface geometry. More...
 
H3DUniquePtr< SFNormalNodeskinNormal
 The skinNormal field contains the normal data definition which is used by the internal mechanisms of the HAnimHumanoid object to create the appropriate surface deformations as well as the indexed face set definitions within the skin field, which contains the actual surface geometry that is rendered. More...
 
H3DUniquePtr< SFVec3fcenter
 The center field specifies a translation offset from the origin of the local coordinate system (0,0,0). More...
 
H3DUniquePtr< SFRotationrotation
 The rotation field specifies a rotation of the coordinate system of the humanoid figure. More...
 
H3DUniquePtr< SFVec3fscale
 The scale field specifies a non-uniform scale of the humanoid figure coordinate system and the scale values shall be greater than zero. More...
 
H3DUniquePtr< SFRotationscaleOrientation
 The scaleOrientation specifies a rotation of the coordinate system of the humanoid figure before the scale (to specify scales in arbitrary orientations). More...
 
H3DUniquePtr< SFVec3ftranslation
 The translation field specifies a translation to the coordinate system of the entire humanoid figure. More...
 
H3DUniquePtr< SFStringrenderMode
 The renderMode field defines how the humanoid should be rendered. More...
 
- Public Attributes inherited from H3D::X3DNode
H3DUniquePtr< SFNodemetadata
 Meta data about the node. More...
 
- Public Attributes inherited from H3D::X3DBoundedObject
H3DUniquePtr< SFVec3fbboxCenter
 Specifies a the center of an axis-aligned bounding box enclosing the node. More...
 
H3DUniquePtr< SFVec3fbboxSize
 Specifies a the size of an axis-aligned bounding box enclosing the node. More...
 
- Public Attributes inherited from H3D::H3DBoundedObject
H3DUniquePtr< SFBoundbound
 The field containing the bound object. More...
 
- Public Attributes inherited from H3D::H3DDisplayListObject
H3DUniquePtr< DisplayListdisplayList
 The DisplayList instance handling the OpenGL caching of this object.
 

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 
- Static Public Attributes inherited from H3D::X3DNode
static H3DNodeDatabase database
 The H3DNodeDatabase for this node.
 

Protected Member Functions

template<class VectorType >
void updateCoordinates (const VectorType &orig_points, const vector< Vec3f > &orig_normals, VectorType &modified_points, vector< Vec3f > &modified_normals)
 Template function to apply the joint movements and displacements to original skin coordinates and normals. More...
 
template<class VectorType >
void updateCoordinatesLBS (const VectorType &orig_points, const vector< Vec3f > &orig_normals, VectorType &modified_points, vector< Vec3f > &modified_normals)
 Function for updating the coordinates using linear blend skinning. More...
 
template<class VectorType >
void updateCoordinatesLBS2 (const VectorType &orig_points, const vector< Vec3f > &orig_normals, VectorType &modified_points, vector< Vec3f > &modified_normals)
 Function for updating the coordinates using linear blend skinning using blending of matrices. More...
 
template<class VectorType >
void updateCoordinatesDLB (const VectorType &orig_points, const vector< Vec3f > &orig_normals, VectorType &modified_points, vector< Vec3f > &modified_normals)
 Function for updating the coordinates using dual quaternion linear blending. More...
 
- Protected Member Functions inherited from H3D::Node
void cloneFieldValue (Field &_from, Field &_to, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for the clone() method. More...
 

Protected Attributes

AutoRef< Transformroot_transform
 Transform node that will contain the skin nodes and which values will be controlled by the transformation fields in the HAnimHumanoid. More...
 
vector< Vec3dpoints_double
 vector for storing the original points before joint and displacer modification if the original coord data is double precision.
 
vector< Vec3f > points_single
 vector for storing the original points before joint and displacer modification if the original coord data is single precision.
 
vector< Vec3f > normals_single
 vector for storing the original normals before joint and displacer modification if the original normal data is single precision.
 
AutoRef< X3DCoordinateNodecurrent_coordinate
 The coordinate node that was used as base coordinate in last traverseSG.
 
AutoRef< X3DNormalNodecurrent_normal
 The normal node that was used as base normals in last traverseSG.
 
H3DUniquePtr< FieldjointMatrixChanged
 Field used to know if any values have changed so that the coordinates have to be updated. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from H3D::Node
static unsigned int nrNodesAlive ()
 Returns the nr of nodes currently alive, i.e. nodes created but not destructed.
 
static int nrNodesCreated ()
 Returns the number of nodes created in total since the start of the program.
 
- Static Protected Member Functions inherited from H3D::Node
static NodegetClonedInstance (Node *original, bool deepCopy, DeepCopyMap &deepCopyMap)
 A helper function for nodes that implement clone() More...
 

Detailed Description

The HAnimHumanoid node is a container for the entire humanoid.

In addition it is used to store human-readable data such as author and copyright information, as well as to store references to the HAnimJoint, HAnimSegment, and HAnimSite nodes in addition to serving as a container for the entire humanoid. Thus, it serves as a central node for moving the humanoid through its environment.

Note
This nodes functionality is not fully implemented, only joints are used.

Examples:

Internal routes:

Member Typedef Documentation

◆ SFNormalNode

The SFNormalNode is dependent on the propertyChanged field of the

contained X3DNormalNode.

Member Function Documentation

◆ closestPoint()

void HAnimHumanoid::closestPoint ( const Vec3f &  p,
NodeIntersectResult result 
)
virtual

Find closest point on Node to p.

Calls closestPoint for all skin

Parameters
pThe point to find the closest point to.
resultA struct containing various results of closest points such as which geometries the closest points where detected on.

Reimplemented from H3D::Node.

References root_transform.

◆ lineIntersect()

bool HAnimHumanoid::lineIntersect ( const Vec3f &  from,
const Vec3f &  to,
LineIntersectResult result 
)
virtual

Detect intersection between a line segment and a Node.

Calls lineIntersect for all skin

Parameters
fromThe start of the line segment.
toThe end of the line segment.
resultContains info about the closest intersection for every object that intersects the line.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References root_transform.

◆ movingSphereIntersect()

bool HAnimHumanoid::movingSphereIntersect ( H3DFloat  radius,
const Vec3f &  from,
const Vec3f &  to,
NodeIntersectResult result 
)
virtual

Detect collision between a moving sphere and the Node.

Calls movingSphereIntersect for all skin

Parameters
radiusThe radius of the sphere
fromThe start position of the sphere
toThe end position of the sphere.
resultA struct containing various results of intersections such as which geometries intersected the moving sphere.
Returns
true if intersected, false otherwise.

Reimplemented from H3D::Node.

References root_transform.

◆ updateCoordinates()

template<class VectorType >
void HAnimHumanoid::updateCoordinates ( const VectorType &  orig_points,
const vector< Vec3f > &  orig_normals,
VectorType &  modified_points,
vector< Vec3f > &  modified_normals 
)
protected

Template function to apply the joint movements and displacements to original skin coordinates and normals.

Since the points can be both floats or doubles a template is used.

Parameters
orig_pointsThe original points before any deformation.
orig_normalsThe original normals before any deformation.
modified_pointsAt input a copy of orig_points, at function return it will contain the points with the deformations applied.
modified_normalsAt input a copy of orig_normals, at function return it will contain the normals with the deformations applied.

References H3D::HAnimJoint::accumulatedJointMatrix, H3D::HAnimDisplacer::displaceCoordinates(), H3D::HAnimJoint::displacers, joints, renderMode, H3DUtil::AutoRefVector< class >::size(), updateCoordinatesDLB(), and updateCoordinatesLBS2().

Referenced by traverseSG().

◆ updateCoordinatesDLB()

template<class VectorType >
void HAnimHumanoid::updateCoordinatesDLB ( const VectorType &  orig_points,
const vector< Vec3f > &  orig_normals,
VectorType &  modified_points,
vector< Vec3f > &  modified_normals 
)
protected

Function for updating the coordinates using dual quaternion linear blending.

Parameters
orig_pointsThe original points before any deformation.
orig_normalsThe original normals before any deformation.
modified_pointsAt input a copy of orig_points, at function return it will contain the points with the deformations applied.
modified_normalsAt input a copy of orig_normals, at function return it will contain the normals with the deformations applied.

References H3DMax().

Referenced by updateCoordinates().

◆ updateCoordinatesLBS()

template<class VectorType >
void HAnimHumanoid::updateCoordinatesLBS ( const VectorType &  orig_points,
const vector< Vec3f > &  orig_normals,
VectorType &  modified_points,
vector< Vec3f > &  modified_normals 
)
protected

Function for updating the coordinates using linear blend skinning.

Parameters
orig_pointsThe original points before any deformation.
orig_normalsThe original normals before any deformation.
modified_pointsAt input a copy of orig_points, at function return it will contain the points with the deformations applied.
modified_normalsAt input a copy of orig_normals, at function return it will contain the normals with the deformations applied.

References H3D::HAnimJoint::accumulatedJointMatrix, H3DMax(), joints, H3DUtil::AutoRefVector< class >::size(), H3D::HAnimJoint::skinCoordIndex, and H3D::HAnimJoint::skinCoordWeight.

◆ updateCoordinatesLBS2()

template<class VectorType >
void HAnimHumanoid::updateCoordinatesLBS2 ( const VectorType &  orig_points,
const vector< Vec3f > &  orig_normals,
VectorType &  modified_points,
vector< Vec3f > &  modified_normals 
)
protected

Function for updating the coordinates using linear blend skinning using blending of matrices.

Same results as updateCoordinateLBS.

Parameters
orig_pointsThe original points before any deformation.
orig_normalsThe original normals before any deformation.
modified_pointsAt input a copy of orig_points, at function return it will contain the points with the deformations applied.
modified_normalsAt input a copy of orig_normals, at function return it will contain the normals with the deformations applied.

References H3D::HAnimJoint::accumulatedJointMatrix, H3DMax(), joints, H3DUtil::AutoRefVector< class >::size(), H3D::HAnimJoint::skinCoordIndex, and H3D::HAnimJoint::skinCoordWeight.

Referenced by updateCoordinates().

Member Data Documentation

◆ center

H3DUniquePtr< SFVec3f > H3D::HAnimHumanoid::center

The center field specifies a translation offset from the origin of the local coordinate system (0,0,0).

Access type: inputOutput
Default value: Vec3f( 0, 0, 0 )

Referenced by initialize().

◆ info

H3DUniquePtr< MFString > H3D::HAnimHumanoid::info

The info field consists of a sequence of strings, each of which is of the form "tag=value".

The following tags are currently defined by the H-Anim Specification:

  • authorName
  • authorEmail
  • copyright
  • creationDate
  • usageRestrictions
  • humanoidVersion
  • age
  • gender
  • height
  • weight

The gender tag typically has a value of "female", "male" or "neuter". The humanoidVersion tag refers to the version of the humanoid being used, in order to track revisions to the data. It is not the same as the version field of the Humanoid object, which refers to the version of the H-Anim specification that was used when building the humanoid. Additional tag=value pairs can be included as needed for specific applications and can be proposed as additions to future versions of this International Standard.

Access type: inputOutput
Default value: []

◆ jointMatrixChanged

H3DUniquePtr< Field > H3D::HAnimHumanoid::jointMatrixChanged
protected

Field used to know if any values have changed so that the coordinates have to be updated.

All joints accumulatedJointMatrx and displacers fields are routed here.

Referenced by traverseSG().

◆ joints

H3DUniquePtr< MFJoint > H3D::HAnimHumanoid::joints

The joints field contains a list of references, one for each HAnimJoint object defined within the skeleton field hierarchy of the HAnimHumanoid object.

The order in which the joints are listed is irrelevant since the names of the joints are stored in the HAnimJoint objects themselves.

Access type: inputOutput

Referenced by updateCoordinates(), updateCoordinatesLBS(), and updateCoordinatesLBS2().

◆ name

H3DUniquePtr< SFString > H3D::HAnimHumanoid::name

The name field stores the name of the humanoid defined by the Humanoid object.

Access type: inputOutput
Default value: ""

◆ renderMode

H3DUniquePtr< SFString > H3D::HAnimHumanoid::renderMode

The renderMode field defines how the humanoid should be rendered.

  • "SKIN" - the skin in the skin field is renderes using linear blend skinning
  • "SKIN_DLB" - the skin in the skin field is renderes using dual quaternion linear blending (see "Skinning with Dual Quaternion" paper by Kavan).
  • "JOINTS" - a sphere is rendered for each joint
  • "SKELETON" - a sphere is rendered for each joint and a line is drawn between the connected joints.

Access type: inputOutput
Default value: "SKIN", "SKIN_DLB", "JOINTS", "SKELETON"
Default value: "SKIN"

Referenced by render(), and updateCoordinates().

◆ root_transform

AutoRef< Transform > H3D::HAnimHumanoid::root_transform
protected

Transform node that will contain the skin nodes and which values will be controlled by the transformation fields in the HAnimHumanoid.


Referenced by closestPoint(), initialize(), lineIntersect(), movingSphereIntersect(), render(), and traverseSG().

◆ rotation

H3DUniquePtr< SFRotation > H3D::HAnimHumanoid::rotation

The rotation field specifies a rotation of the coordinate system of the humanoid figure.

Access type: inputOutput
Default value: Rotation( 0, 0, 1, 0 )

Referenced by initialize().

◆ scale

H3DUniquePtr< SFVec3f > H3D::HAnimHumanoid::scale

The scale field specifies a non-uniform scale of the humanoid figure coordinate system and the scale values shall be greater than zero.

Access type: inputOutput
Default value: Vec3f( 1, 1, 1 )

Referenced by initialize().

◆ scaleOrientation

H3DUniquePtr< SFRotation > H3D::HAnimHumanoid::scaleOrientation

The scaleOrientation specifies a rotation of the coordinate system of the humanoid figure before the scale (to specify scales in arbitrary orientations).

The scaleOrientation applies only to the scale operation.

Access type: inputOutput
Default value: Rotation( 0, 0, 1, 0 )

Referenced by initialize().

◆ segments

H3DUniquePtr< MFSegment > H3D::HAnimHumanoid::segments

The segments field contains a list of references, one for each HAnimSegment object defined within the skeleton field hierarchy of the Humanoid object.

The order in which the segments are listed is irrelevant since the names of the segments are stored in the HAnimSegment objects themselves.

Access type: inputOutput

◆ sites

H3DUniquePtr< MFSite > H3D::HAnimHumanoid::sites

The sites field contains a list of references, one for each HAnimSite object defined within the skeleton field hierarchy of the Humanoid object.

The order in which the sites are listed is irrelevant since the names of the sites are stored in the HAnimSite objects themselves.

Access type: inputOutput

◆ skeleton

H3DUniquePtr< MFSkeletonNode > H3D::HAnimHumanoid::skeleton

The skeleton field contains the HAnimHumanoid root HAnimJoint object.


The HAnimHumanoid object is considered the parent object of this joint object and defines a coordinate space for it. Thus, the HAnimHumanoid object's transformation affects the HAnimJoint object hierarchy in the skeleton field. A hierarchy of HAnimJoint objects is defined for each H-Anim humanoid figure within the skeleton field of the HAnimHumanoid object and a hierarchical definition of joints is present even when the geometry of the humanoid figure is not defined within the skeleton field. The skeleton field contain can also contain zero or more HAnimSite objects which allow landmarks to be established with respect to the overall humanoid figure, but which will not be affected by the movement of any of the HAnimJoint objects.

Access type: inputOutput

Referenced by render(), and traverseSG().

◆ skin

H3DUniquePtr< MFChild > H3D::HAnimHumanoid::skin

The skin field contains the nodes that define the graphical appearance of the HAnimHumanoid.

It should contain one or more triangle set definitions that utilize the point and normal data that is defined within the skinCoord and skinNormal fields.

Access type: inputOutput

Referenced by initialize().

◆ skinCoord

H3DUniquePtr< SFCoordinateNode > H3D::HAnimHumanoid::skinCoord

The skinCoord field contains a single sequence of points which are used by the internal mechanisms of the HAnimHumanoid object to create the appropriate surface deformations as well as by the indexed face set definitions within the skin field which do the actual rendering of the surface geometry.

Access type: inputOutput

Referenced by traverseSG().

◆ skinNormal

H3DUniquePtr< SFNormalNode > H3D::HAnimHumanoid::skinNormal

The skinNormal field contains the normal data definition which is used by the internal mechanisms of the HAnimHumanoid object to create the appropriate surface deformations as well as the indexed face set definitions within the skin field, which contains the actual surface geometry that is rendered.

Access type: inputOutput

Referenced by traverseSG().

◆ translation

H3DUniquePtr< SFVec3f > H3D::HAnimHumanoid::translation

The translation field specifies a translation to the coordinate system of the entire humanoid figure.

Access type: inputOutput
Default value: Vec3f( 0, 0, 0 )

Referenced by initialize().

◆ use_union_bound

bool H3D::HAnimHumanoid::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 the grouping node.


◆ version

H3DUniquePtr< SFString > H3D::HAnimHumanoid::version

The version field stores the version of the H-Anim International Standard to which the Humanoid object conforms.

E.g. "200x".

Access type: inputOutput
Default value: ""

◆ viewpoints

H3DUniquePtr< MFSite > H3D::HAnimHumanoid::viewpoints

The viewpoints field has a different functionality and behaviour than the joints, segments and sites fields.

The viewpoints field can contain zero or more HAnimSite object definitions. The HAnimSite objects defined within this field are affected by the transformations applied to the HAnimHumanoid object, but are not affected by any of the transformations performed on the skeletal hierarchy defined within the skeleton field. The purpose of these HAnimSite objects is to define locations for virtual cameras in the reference frame of the HAnimHumanoid object. HAnimSite objects that are defined in this manner are intended to be used as attachment points from which a certain viewing perspective can be seen (such as viewing the face or profile of the human figure).

Access type: inputOutput


The documentation for this class was generated from the following files: