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

Static Public Member Functions

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

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). More...
 
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). More...
 

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

typedef vector<Bone*>::type Ogre::Bone::BoneVec

◆ TagPointVec

typedef vector<TagPoint*>::type Ogre::Bone::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 ( ) 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 ( ) 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 ( )

@See _getDerivedScaleUpdated remarks.

@See _getFullTransform

◆ _getLocalSpaceTransform()

FORCEINLINE const SimpleMatrixAf4x3& Ogre::Bone::_getLocalSpaceTransform ( ) 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 ( )

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

◆ _setCachedTransformOutOfDate()

virtual void Ogre::Bone::_setCachedTransformOutOfDate ( )
virtual

◆ _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 ( )
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 ( ) 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 ( ) 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 ( ) const
inline

Returns the name of the node.

◆ getNumChildren()

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

Reports the number of child nodes under this one.

◆ getNumTagPoints()

size_t Ogre::Bone::getNumTagPoints ( ) const
inline

Reports the number of tag points 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 ( ) const
inline

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

◆ getPosition()

Vector3 Ogre::Bone::getPosition ( ) 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 ( ) 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

◆ getTagPoint() [1/2]

TagPoint* Ogre::Bone::getTagPoint ( size_t  index)
inline

Gets a pointer to a child tag point.

◆ getTagPoint() [2/2]

const TagPoint* Ogre::Bone::getTagPoint ( size_t  index) const
inline

◆ getTagPoints()

const TagPointVec& Ogre::Bone::getTagPoints ( )
inline

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

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

◆ isCachedTransformOutOfDate()

bool Ogre::Bone::isCachedTransformOutOfDate ( ) const
inline

◆ 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: