OGRE 2.1
Object-Oriented Graphics Rendering Engine
Loading...
Searching...
No Matches
Ogre::Bone Class Reference

Class representing a Bone in the join hierarchy of a skeleton. More...

#include <OgreBone.h>

+ Inheritance diagram for Ogre::Bone:

Public Types

typedef vector< Bone * >::type BoneVec
 
typedef vector< TagPoint * >::type TagPointVec
 

Public Member Functions

 Bone ()
 
virtual ~Bone ()
 
void _deinitialize (bool debugCheckLifoOrder=true)
 
Matrix4 _getDerivedTransform (void) const
 Gets the derived transform in world space.
 
FORCEINLINE const SimpleMatrixAf4x3_getFullTransform (void) const
 Gets the full transformation matrix for this node.
 
const SimpleMatrixAf4x3_getFullTransformUpdated (void)
 @See _getDerivedScaleUpdated remarks.
 
FORCEINLINE const SimpleMatrixAf4x3_getLocalSpaceTransform (void) const
 Gets the transformation matrix for this bone in local space (i.e.
 
BoneTransform_getTransform ()
 Returns a direct access to the Transform state.
 
void _initialize (IdType id, BoneMemoryManager *boneMemoryManager, Bone *parent, ArrayMatrixAf4x3 const *RESTRICT_ALIAS reverseBind)
 
void _memoryRebased (void)
 Internal use. Called from BoneMemoryManager's rebases (i.e. cleanups, grows)
 
void _setNodeParent (Node *nodeParent)
 Sets a regular Node to be parent of this Bone.
 
void _setReverseBindPtr (const ArrayMatrixAf4x3 *ptr)
 
void addTagPoint (TagPoint *tagPoint)
 Makes the TagPoint child of this Bone.
 
BonegetChild (size_t index)
 Gets a pointer to a child node.
 
const BonegetChild (size_t index) const
 
const BoneVecgetChildren (void)
 Retrieves the container for efficiently iterating through all children of this bone.
 
uint16 getDepthLevel () const
 Returns how deep in the hierarchy we are (eg. 0 -> root node, 1 -> child of root)
 
IdType getId () const
 Get the unique id of this object.
 
bool getInheritOrientation (void) const
 Returns true if this node is affected by orientation applied to the parent node.
 
bool getInheritScale (void) const
 Returns true if this node is affected by scaling factors applied to the parent node.
 
const StringgetName (void) const
 Returns the name of the node.
 
size_t getNumChildren (void) const
 Reports the number of child nodes under this one.
 
Quaternion getOrientation () const
 Returns a quaternion representing the nodes orientation.
 
BonegetParent (void) const
 Gets this Bones's parent (NULL if this is the root).
 
Vector3 getPosition (void) const
 Gets the position of the node relative to its parent.
 
Vector3 getScale (void) const
 Gets the scale of the node relative to its parent.
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete (void *ptr, void *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info
 
voidoperator new (size_t sz, void *ptr)
 placement operator new
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info
 
bool operator() (const IdObject &left, const IdObject &right)
 
bool operator() (const IdObject *left, const IdObject *right)
 
void removeTagPoint (TagPoint *tagPoint)
 
void setInheritOrientation (bool inherit)
 Tells the Bone whether it should inherit orientation from it's parent node.
 
void setInheritScale (bool inherit)
 Tells the node whether it should inherit scaling factors from it's parent node.
 
void setName (const String &name)
 Sets a custom name for this node. Doesn't have to be unique.
 
void setOrientation (Quaternion q)
 Sets a given orientation in local space (ie.
 
void setPosition (const Vector3 &pos)
 Sets the position of the node relative to its parent.
 
void setScale (const Vector3 &pos)
 Sets the scale of the node relative to its parent.
 

Static Public Member Functions

static void updateAllTransforms (const size_t numNodes, BoneTransform t, ArrayMatrixAf4x3 const *RESTRICT_ALIAS reverseBind, size_t numBinds)
 TODO.
 

Public Attributes

size_t mGlobalIndex
 Index in the vector holding this node reference (could be our parent node, or a global array tracking all created nodes to avoid memory leaks).
 
size_t mParentIndex
 Index in the vector holding this node reference (could be our parent node, or a global array tracking all created nodes to avoid memory leaks).
 

Detailed Description

Class representing a Bone in the join hierarchy of a skeleton.

Remarks
Unlike 1.9; a Bone is practically a SceneNode in all purposes. It can even have objects directly attached to them. The only reason we need to overload is because the mDerivedTransform matrix is constructed differently, since it is not in world space, but rather in "offset space" (world space minus the reverse transform of the original bind pose). mDerivedPosition, mDeriverdOrientation and mDerivedScale are still in world space though, it's only the 4x4 matrix we send to the GPU that is in a different space.

Member Typedef Documentation

◆ BoneVec

◆ TagPointVec

Constructor & Destructor Documentation

◆ Bone()

Ogre::Bone::Bone ( )

◆ ~Bone()

virtual Ogre::Bone::~Bone ( )
virtual

Member Function Documentation

◆ _deinitialize()

void Ogre::Bone::_deinitialize ( bool  debugCheckLifoOrder = true)

◆ _getDerivedTransform()

Matrix4 Ogre::Bone::_getDerivedTransform ( void  ) const

Gets the derived transform in world space.

Remarks
Position, scale & orientation can be extracted using Matrix4::decomposition Note, that matrices may contain stretch and shearing (aka non-uniform scaling) which doesn't translate well to a scale/orientation paradigm (not a problem if the bones don't use scaling, or if scale is not inherited).

◆ _getFullTransform()

FORCEINLINE const SimpleMatrixAf4x3 & Ogre::Bone::_getFullTransform ( void  ) const
inline

Gets the full transformation matrix for this node.

Remarks
This method returns the full transformation matrix for this node, including the effect of any parent Bone transformations.
Assumes the caches are already updated.
The transform is in "world bone" space, unless our root parent called _setNodeParent( nullptr ) in which case the transform will be in local bone space.

References Ogre::BoneTransform::mFinalTransform, and Ogre::BoneTransform::mIndex.

◆ _getFullTransformUpdated()

const SimpleMatrixAf4x3 & Ogre::Bone::_getFullTransformUpdated ( void  )

@See _getDerivedScaleUpdated remarks.

@See _getFullTransform

◆ _getLocalSpaceTransform()

FORCEINLINE const SimpleMatrixAf4x3 & Ogre::Bone::_getLocalSpaceTransform ( void  ) const
inline

Gets the transformation matrix for this bone in local space (i.e.

as if the skeleton wasn't attached to a SceneNode).

Remarks
This method returns the full transformation matrix for this node, including the effect of any parent Bone transformations.
Assumes the caches are already updated.

References Ogre::BoneTransform::mDerivedTransform, and Ogre::BoneTransform::mIndex.

◆ _getTransform()

BoneTransform & Ogre::Bone::_getTransform ( )
inline

Returns a direct access to the Transform state.

◆ _initialize()

void Ogre::Bone::_initialize ( IdType  id,
BoneMemoryManager boneMemoryManager,
Bone parent,
ArrayMatrixAf4x3 const *RESTRICT_ALIAS  reverseBind 
)

◆ _memoryRebased()

void Ogre::Bone::_memoryRebased ( void  )

Internal use. Called from BoneMemoryManager's rebases (i.e. cleanups, grows)

◆ _setNodeParent()

void Ogre::Bone::_setNodeParent ( Node nodeParent)

Sets a regular Node to be parent of this Bone.

DO NOT USE THIS FUNCTION IF YOU DON'T KNOW WHAT YOU'RE DOING. If you want to use a regular Node to control a bone,

See also
SkeletonInstance::setSceneNodeAsParentOfBone instead.
Remarks
  1. Multiple calls to _setNodeParent with different arguments will silently override previous calls.
  2. By the time we update, we assume the Node has already been updated. (even when calling _getDerivedPositionUpdated and Co)
  3. Null pointers will "detach", causing derived updates to be in local space
  4. Ogre must ensure that when a NodeMemoryManager performs a cleanup (or resizes), this function is called again (to update our pointers).

◆ _setReverseBindPtr()

void Ogre::Bone::_setReverseBindPtr ( const ArrayMatrixAf4x3 ptr)
inline

◆ addTagPoint()

void Ogre::Bone::addTagPoint ( TagPoint tagPoint)

Makes the TagPoint child of this Bone.

◆ getChild() [1/2]

Bone * Ogre::Bone::getChild ( size_t  index)
inline

Gets a pointer to a child node.

◆ getChild() [2/2]

const Bone * Ogre::Bone::getChild ( size_t  index) const
inline

◆ getChildren()

const BoneVec & Ogre::Bone::getChildren ( void  )
inline

Retrieves the container for efficiently iterating through all children of this bone.

Remarks
Using this is faster than repeatedly calling getChild if you want to go through all (or most of) the children of this bone.

◆ getDepthLevel()

uint16 Ogre::Bone::getDepthLevel ( ) const
inline

Returns how deep in the hierarchy we are (eg. 0 -> root node, 1 -> child of root)

◆ getId()

IdType Ogre::IdObject::getId ( ) const
inlineinherited

Get the unique id of this object.

◆ getInheritOrientation()

bool Ogre::Bone::getInheritOrientation ( void  ) const

Returns true if this node is affected by orientation applied to the parent node.

Remarks
@See setInheritOrientation for more info.

◆ getInheritScale()

bool Ogre::Bone::getInheritScale ( void  ) const

Returns true if this node is affected by scaling factors applied to the parent node.

Remarks
@See setInheritOrientation for more info.

◆ getName()

const String & Ogre::Bone::getName ( void  ) const
inline

Returns the name of the node.

◆ getNumChildren()

size_t Ogre::Bone::getNumChildren ( void  ) const
inline

Reports the number of child nodes under this one.

◆ getOrientation()

Quaternion Ogre::Bone::getOrientation ( ) const
inline

Returns a quaternion representing the nodes orientation.

Remarks
Don't call this function too often, as we need to convert from SoA

◆ getParent()

Bone * Ogre::Bone::getParent ( void  ) const
inline

Gets this Bones's parent (NULL if this is the root).

◆ getPosition()

Vector3 Ogre::Bone::getPosition ( void  ) const
inline

Gets the position of the node relative to its parent.

Remarks
Don't call this function too often, as we need to convert from SoA

◆ getScale()

Vector3 Ogre::Bone::getScale ( void  ) const
inline

Gets the scale of the node relative to its parent.

Remarks
Don't call this function too often, as we need to convert from SoA

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void ptr,
void  
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void ptr,
const char ,
int  ,
const char  
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [2/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [3/3]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ operator new[]() [2/2]

template<class Alloc >
void * Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char file,
int  line,
const char func 
)
inlineinherited

array operator new, with debug line info

◆ operator()() [1/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ operator()() [2/2]

bool Ogre::IdObject::operator() ( const IdObject left,
const IdObject right 
)
inlineinherited

◆ removeTagPoint()

void Ogre::Bone::removeTagPoint ( TagPoint tagPoint)

◆ setInheritOrientation()

void Ogre::Bone::setInheritOrientation ( bool  inherit)

Tells the Bone whether it should inherit orientation from it's parent node.

Remarks
@See Node::setInheritOrientation remarks. Note that Nodes and bones inherit scale and orientation differently, because Bones support non-uniform scaling, whereas Nodes don't.
They may behave differently, because we assume inherited scale is never negative (due to this information being lost when embedded into a matrix. This mimics the behavior of major 3D modeling tools. i.e. scaling by x = -1 & y = -1 is the same as rotating 180° around Z axis) Default is true.
Parameters
inheritIf true, this node's orientation will be affected by its parent's orientation. If false, it will not be affected.

◆ setInheritScale()

void Ogre::Bone::setInheritScale ( bool  inherit)

Tells the node whether it should inherit scaling factors from it's parent node.

Remarks
@See setInheritOrientation.
Parameters
inheritIf true, this node's scale will be affected by its parent's scale. If false, it will not be affected.

◆ setName()

void Ogre::Bone::setName ( const String name)
inline

Sets a custom name for this node. Doesn't have to be unique.

◆ setOrientation()

void Ogre::Bone::setOrientation ( Quaternion  q)
inline

Sets a given orientation in local space (ie.

relative to its parent)

Remarks
Don't call this function too often, as we need to convert to SoA

◆ setPosition()

void Ogre::Bone::setPosition ( const Vector3 pos)
inline

Sets the position of the node relative to its parent.

Remarks
Don't call this function too often, as we need to convert to SoA

◆ setScale()

void Ogre::Bone::setScale ( const Vector3 pos)
inline

Sets the scale of the node relative to its parent.

Remarks
Don't call this function too often, as we need to convert to SoA

◆ updateAllTransforms()

static void Ogre::Bone::updateAllTransforms ( const size_t  numNodes,
BoneTransform  t,
ArrayMatrixAf4x3 const *RESTRICT_ALIAS  reverseBind,
size_t  numBinds 
)
static

Member Data Documentation

◆ mGlobalIndex

size_t Ogre::Bone::mGlobalIndex

Index in the vector holding this node reference (could be our parent node, or a global array tracking all created nodes to avoid memory leaks).

Used for O(1) removals.

Remarks
It is the parent (or our creator) the one that sets this value, not ourselves. Do NOT modify it manually.

◆ mParentIndex

size_t Ogre::Bone::mParentIndex

Index in the vector holding this node reference (could be our parent node, or a global array tracking all created nodes to avoid memory leaks).

Used for O(1) removals.

Remarks
It is the parent (or our creator) the one that sets this value, not ourselves. Do NOT modify it manually.

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