Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

Bone Class Reference

#include <bone.h>

Inheritance diagram for Bone:

Inheritance graph
[legend]
Collaboration diagram for Bone:

Collaboration graph
[legend]
List of all members.

Detailed Description

Data defining a single bone A bone is a simple node in a hierarchy (a skeleton). Bones are managed by skeleton, and must belong to a single master skeleton object. A skeleton can only have a single root bone.

Author:
Mattias Jansson (mattias@realityrift.com)


Public Types


Public Member Functions

 Bone (unsigned int uiID=0, const std::string &rstrName="", Bone *pkParent=0)
 Bone (Bone &rkBone)
virtual ~Bone ()
virtual BoneDuplicate ()
virtual void SetTranslation (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
virtual void SetRotation (const Quaternion &rkRotation, bool bNotifyUpdate=true)
virtual void SetScaling (float fScaling, bool bNotifyUpdate=true)
void SetName (const HashString &rstrName)
const HashStringGetName () const
BoneGetParent ()
virtual int AttachNode (Bone *pkNode, bool bKeepWorldSRT=false)
virtual int DetachNode (Bone *pkNode)
void DetachFromParent ()
virtual void NotifyUpdate (bool bRecurse=true)
const Vector3dGetWorldTranslation ()
const QuaternionGetWorldRotation ()
float GetWorldScaling ()
const MatrixGetWorldTransform ()
const MatrixGetInverseWorldTransform ()
const std::vector< Bone * > & GetChildren ()
BoneGetByName (const HashString &rstrName, NODESEARCHMODE eMode=BREADTH_FIRST, bool bInitSearch=true)
virtual void Traverse (BaseVisitor &rkVisitor, NODESEARCHMODE eMode=DEPTH_FIRST, int iDirection=1, bool bInitSearch=true)
virtual void TraverseNode (BaseVisitor &rkVisitor)
virtual void Accept (BaseVisitor &rkVisitor)=0
const Vector3dGetTranslation () const
const QuaternionGetRotation () const
float GetScaling () const
void Translate (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
void TranslateWorld (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
void Rotate (const Quaternion &rkRotation, bool bNotifyUpdate=true)
void RotateWorld (const Quaternion &rkRotation, bool bNotifyUpdate=true)
void Scale (float fScaling, bool bNotifyUpdate=true)

Public Attributes

unsigned int m_uiID

Protected Member Functions

virtual bool UpdateWorld ()
virtual BoneGet ()

Static Protected Member Functions

template<class NodeType> void AcceptImpl (NodeType &rkVisited, BaseVisitor &rkVisitor)

Protected Attributes

bool m_bWorldUpdate
float m_fWorldScaling
Quaternion m_kWorldRotation
Vector3d m_kWorldTranslation
std::vector< Bone * > m_vpkChildren
Bonem_pkParent
HashString m_strName
Matrix m_kWorldTransform
Matrix m_kInverseWorldTransform
float m_fScaling
Quaternion m_kRotation
Vector3d m_kTranslation


Constructor & Destructor Documentation

Bone unsigned int  uiID = 0,
const std::string &  rstrName = "",
Bone pkParent = 0
 

Parameters:
uiID Bone ID
rstrName Bone node name
pkParent Parent bone

Bone Bone rkBone  ) 
 

Create bone from reference object, will also duplicate hierarchy (child nodes)

Parameters:
rkBone Reference bone object to copy

virtual ~Bone  )  [virtual]
 

Deregister bone with skeleton


Member Function Documentation

virtual Bone* Duplicate  )  [virtual]
 

Duplicate bone

Returns:
New bone that is exact duplicate of this node

virtual bool UpdateWorld  )  [inline, protected, virtual, inherited]
 

Updates cached world-relative SRT data if needed

Returns:
true if any world cache data was updated, false if not

virtual Bone * Get  )  [inline, protected, virtual, inherited]
 

Used to get this as correct type

Returns:
This node

virtual void SetTranslation const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, virtual, inherited]
 

Set position relative parent node. Will set flag to update world cache data, and optionally recurse and flag child nodes to update data

Parameters:
rkTranslation New translation relative parent node
bNotifyUpdate Set update flag to child tree for world SRT data and parent tree for bounding volume (true default, use false with caution)

Reimplemented from SRTNode.

virtual void SetRotation const Quaternion rkRotation,
bool  bNotifyUpdate = true
[inline, virtual, inherited]
 

Set rotation relative parent node. Will set flag to update world cache data, and optionally recurse and flag child nodes to update data

Parameters:
rkRotation New rotation relative parent node
bNotifyUpdate Set update flag to child tree for world SRT data (true default, use false with caution)

Reimplemented from SRTNode.

virtual void SetScaling float  fScaling,
bool  bNotifyUpdate = true
[inline, virtual, inherited]
 

Set uniform scaling relative parent node. Will set flag to update world cache data, and optionally recurse and flag child nodes to update data

Parameters:
fScaling Uniform scaling factor
bNotifyUpdate Set update flag to child tree for world SRT data (true default, use false with caution)

Reimplemented from SRTNode.

void SetName const HashString rstrName  )  [inline, inherited]
 

Set name

Parameters:
rstrName New node name

const HashString& GetName  )  const [inline, inherited]
 

Returns:
Node name

Bone * GetParent  )  [inline, inherited]
 

Returns:
Parent node

virtual int AttachNode Bone pkNode,
bool  bKeepWorldSRT = false
[virtual, inherited]
 

Attach node. If the node is attached to a parent, detach it first. This will cause the node to get it's world SRT data as local SRT data. If bKeepWorldSRT is set, node will be updated with inverse of this (new parent) node's SRT data, effectively keeping it intact in world space. If flag not set, node will effectivaly get new parent world SRT data added to own (used in initialization phase, for example).

Parameters:
pkNode Node to attach
bKeepWorldSRT If true, recalculate node relative position to maintain world SRT
Returns:
undefined (reserved for future use or derived classes)

virtual int DetachNode Bone pkNode  )  [virtual, inherited]
 

Detach node. The node will store world SRT data in local SRT data.

Parameters:
pkNode Node to detach
Returns:
undefined (reserved for future use or derived classes)

void DetachFromParent  )  [inherited]
 

Detach this node from parent, if any. Will store world SRT data (and update first if needed) in local SRT data to remain in same world position and orientation.

virtual void NotifyUpdate bool  bRecurse = true  )  [inline, virtual, inherited]
 

Set world update flag. If flag is set, a call to any of the GetWorldScaling, GetWorldRotation, GetWorldTranslation will cause world cache data to be updated. Optionally recurses on all child nodes (default).

Parameters:
bRecurse Recurse on children

Reimplemented in BoneAdaptor.

const Vector3d& GetWorldTranslation  )  [inline, inherited]
 

Get position relative world coordinate system origo. The world SRT data is the combined hierarchial data of any parent nodes and this node.

Returns:
World position

const Quaternion& GetWorldRotation  )  [inline, inherited]
 

Get rotation relative world unrotated coordinate system. The world SRT data is the combined hierarchial data of any parent nodes and this node.

Returns:
World-relative quaternion

float GetWorldScaling  )  [inline, inherited]
 

Get total unform scaling factor relative world scale. The world SRT data is the combined hierarchial data of any parent nodes and this node.

Returns:
World scaling factor

const Matrix& GetWorldTransform  )  [inline, inherited]
 

Get total transform matrix relative world coordinate system origo. The world SRT data is the combined hierarchial data of any parent nodes and this node.

Returns:
World transform matrix

const Matrix& GetInverseWorldTransform  )  [inline, inherited]
 

Get inverse total transform matrix relative world coordinate system origo. The world SRT data is the combined hierarchial data of any parent nodes and this node.

Returns:
Inverse world transform matrix

const std::vector< Bone * >& GetChildren  )  [inline, inherited]
 

Get all child nodes

Returns:
Children node vector

Bone * GetByName const HashString rstrName,
NODESEARCHMODE  eMode = BREADTH_FIRST,
bool  bInitSearch = true
[inherited]
 

Search hierarchy for named node, including this node. Will return first node found along selected search mode.

Parameters:
rstrName Node name to search for
eMode Search mode (see enum descriptions for details)
bInitSearch Internal flag
Returns:
Ptr to node or null if not found

virtual void Traverse BaseVisitor rkVisitor,
NODESEARCHMODE  eMode = DEPTH_FIRST,
int  iDirection = 1,
bool  bInitSearch = true
[virtual, inherited]
 

Traverse the hierarchy applying the visitor to the nodes.

Parameters:
rkVisitor Visitor to apply to each node.
eMode Search mode (see enum descriptions for details)
iDirection Direction of traversal (for DEPTH_FIRST, > 0 means top-down, < 0 means bottom up)
bInitSearch Internal flag

virtual void TraverseNode BaseVisitor rkVisitor  )  [inline, virtual, inherited]
 

Traverse this nodes

Parameters:
rkVisitor Visitor

void AcceptImpl NodeType &  rkVisited,
BaseVisitor rkVisitor
[inline, static, protected, inherited]
 

Accept visitors if implementation available

Parameters:
rkVisited Node being visited
rkVisitor Visitor

virtual void Accept BaseVisitor rkVisitor  )  [pure virtual, inherited]
 

Accept a visitor

Parameters:
rkVisitor Visitor

const Vector3d& GetTranslation  )  const [inline, inherited]
 

Returns:
Translation of this node

const Quaternion& GetRotation  )  const [inline, inherited]
 

Returns:
Rotation of this node

float GetScaling  )  const [inline, inherited]
 

Returns:
Uniform scaling factor

void Translate const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Translate node from current position, in local (along current rotated axes) coordinate system. Will call SetTranslation() for setting new translation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkTranslation Translation offset vector
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void TranslateWorld const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Translate node from current position, in world (along unrotated axes) coordinate system. Will call SetTranslation() for setting new translation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkTranslation Translation offset vector
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void Rotate const Quaternion rkRotation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Rotate node in local (current rotation) coordinate system. Will call SetRotation() for setting new rotation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkRotation Rotation quaternion
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void RotateWorld const Quaternion rkRotation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Rotate node in world (unrotated) coordinate system. Will call SetRotation() for setting new rotation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkRotation Rotation quaternion
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void Scale float  fScaling,
bool  bNotifyUpdate = true
[inline, inherited]
 

Scale node by uniform factor. Will use SetScaling for setting new scaling of node, derived classes do not need to overload this method directly. Must be >0, where a value of 1.0f indicates no scaling

Parameters:
fScaling Uniform scaling factor
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)


Member Data Documentation

unsigned int m_uiID
 

Bone ID

bool m_bWorldUpdate [protected, inherited]
 

Flag indicating we need to update world relative SRT information

float m_fWorldScaling [protected, inherited]
 

Total scaling relative world (cached)

Quaternion m_kWorldRotation [protected, inherited]
 

Total rotation relative world (cached)

Vector3d m_kWorldTranslation [protected, inherited]
 

Total translation relative world (cached)

std::vector< Bone * > m_vpkChildren [protected, inherited]
 

Child nodes

Bone * m_pkParent [protected, inherited]
 

Parent node

HashString m_strName [protected, inherited]
 

Name

Matrix m_kWorldTransform [protected, inherited]
 

Total transformation matrix relative world (cached)

Matrix m_kInverseWorldTransform [protected, inherited]
 

Total inverse transformation matrix relative world (cached)

float m_fScaling [protected, inherited]
 

Uniform scaling factor (must be >0, default 1)

Quaternion m_kRotation [protected, inherited]
 

Rotation

Vector3d m_kTranslation [protected, inherited]
 

Translation


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:10 2004 for NeoEngine by doxygen 1.3.5