OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::SkeletonInstance Class Reference

Instance of a Skeleton, main external interface for retrieving bone positions and applying animations. More...

#include <OgreSkeletonInstance.h>

+ Inheritance diagram for Ogre::SkeletonInstance:
+ Collaboration diagram for Ogre::SkeletonInstance:

Public Types

typedef vector< Bone >::type BoneVec
 

Public Member Functions

 SkeletonInstance (const SkeletonDef *skeletonDef, BoneMemoryManager *boneMemoryManager)
 
 ~SkeletonInstance ()
 
void _disableAnimation (SkeletonAnimation *animation)
 Internal use. Disables given animation. Input should belong to us and already being animated. More...
 
void _enableAnimation (SkeletonAnimation *animation)
 Internal use. Enables given animation. Input should belong to us and not already animated. More...
 
FORCEINLINE const
SimpleMatrixAf4x3
_getBoneFullTransform (size_t index) const
 Gets full transform of a bone by its index. More...
 
const void * _getMemoryBlock (void) const
 
const void * _getMemoryUniqueOffset (void) const
 
const TransformArray_getTransformArray () const
 
void _updateBoneStartTransforms (void)
 Updates the contents of . More...
 
SkeletonAnimationgetAnimation (IdString name)
 Returns the requested animations. Throws if not found. O(N) Linear search. More...
 
BonegetBone (IdString boneName)
 Gets the bone with given name. Throws if not found. More...
 
const SkeletonDefgetDefinition (void) const
 
NodegetParentNode (void) const
 Returns our parent node. May be null. More...
 
void getTransforms (SimpleMatrixAf4x3 *RESTRICT_ALIAS outTransform, const FastArray< unsigned short > &usedBones) const
 
bool hasAnimation (IdString name) const
 
bool isManualBone (Bone *bone)
 Returns true if the bone is manually controlled. More...
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
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 * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void resetToPose (void)
 Resets the transform of all bones to the binding pose. Manual bones are not reset. More...
 
void setManualBone (Bone *bone, bool isManual)
 Sets the given node to manual. More...
 
void setParentNode (Node *parentNode)
 Sets our parent node so that our bones are in World space. More...
 
void update (void)
 

Protected Attributes

ActiveAnimationsVec mActiveAnimations
 
SkeletonAnimationVec mAnimations
 
BoneVec mBones
 
TransformArray mBoneStartTransforms
 
SkeletonDef const * mDefinition
 
RawSimdUniquePtr< ArrayReal,
MEMCATEGORY_ANIMATION
mManualBones
 The start of Transform at each depth level. More...
 
NodemParentNode
 Node this SkeletonInstance is attached to (so we can work in world space) More...
 
FastArray< size_t > mSlotStarts
 
BoneVec mUnusedNodes
 Unused slots for each parent depth level that had more bones than >= ARRAY_PACKED_REALS /2 but less than < ARRAY_PACKED_REALS (or a multiple of it) More...
 

Detailed Description

Instance of a Skeleton, main external interface for retrieving bone positions and applying animations.

Remarks
The new SkeletonInstance uses SIMD to animate up to 4 bones at the same time, though this depends on the number of bones on each parent level depth in the hierachy.
I.e. if there is 1 root bone with 6 child bones; the root node will be animated solo, the first 4 child bones will be animated at the same time, and the 2 last bones will be animated together in the next loop iteration.
Note however, when updating bones in the hierarchy to obtain the derived transforms (rather than animating), the root bone will be updated together using SIMD with the root bones from 3 other SkeletonInstances that share the same SkeletonDef. Only animating them has this restriction. The animation system won't be able to "share" though, if the SkeletonDef had 3 root nodes instead of 1; because we need to put them in a SIMD block in a repeating pattern And repeating 3 bones at least twice gives 6 bones, which doesn't fit in SSE2 (though it should in AVX, where ARRAY_PACKED_REALS = 8)

To those interested in the original repository of OgreAnimation to obtain full history, go to: https://bitbucket.org/dark_sylinc/ogreanimation

Definition at line 71 of file OgreSkeletonInstance.h.

Member Typedef Documentation

Definition at line 74 of file OgreSkeletonInstance.h.

Constructor & Destructor Documentation

Ogre::SkeletonInstance::SkeletonInstance ( const SkeletonDef skeletonDef,
BoneMemoryManager boneMemoryManager 
)
Ogre::SkeletonInstance::~SkeletonInstance ( )

Member Function Documentation

void Ogre::SkeletonInstance::_disableAnimation ( SkeletonAnimation animation)

Internal use. Disables given animation. Input should belong to us and already being animated.

void Ogre::SkeletonInstance::_enableAnimation ( SkeletonAnimation animation)

Internal use. Enables given animation. Input should belong to us and not already animated.

FORCEINLINE const SimpleMatrixAf4x3& Ogre::SkeletonInstance::_getBoneFullTransform ( size_t  index) const
inline

Gets full transform of a bone by its index.

Definition at line 131 of file OgreSkeletonInstance.h.

const void* Ogre::SkeletonInstance::_getMemoryBlock ( void  ) const
const void* Ogre::SkeletonInstance::_getMemoryUniqueOffset ( void  ) const
const TransformArray& Ogre::SkeletonInstance::_getTransformArray ( ) const
inline

Definition at line 165 of file OgreSkeletonInstance.h.

void Ogre::SkeletonInstance::_updateBoneStartTransforms ( void  )

Updates the contents of .

Needed when our memory manager performs a cleanup or similar memory change.

SkeletonAnimation* Ogre::SkeletonInstance::getAnimation ( IdString  name)

Returns the requested animations. Throws if not found. O(N) Linear search.

Bone* Ogre::SkeletonInstance::getBone ( IdString  boneName)

Gets the bone with given name. Throws if not found.

const SkeletonDef* Ogre::SkeletonInstance::getDefinition ( void  ) const
inline

Definition at line 101 of file OgreSkeletonInstance.h.

Node* Ogre::SkeletonInstance::getParentNode ( void  ) const
inline

Returns our parent node. May be null.

Definition at line 155 of file OgreSkeletonInstance.h.

void Ogre::SkeletonInstance::getTransforms ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  outTransform,
const FastArray< unsigned short > &  usedBones 
) const
bool Ogre::SkeletonInstance::hasAnimation ( IdString  name) const
bool Ogre::SkeletonInstance::isManualBone ( Bone bone)

Returns true if the bone is manually controlled.

setManualBone

Parameters
boneBone to query if manual. Must belong to this SkeletonInstance.
template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

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

Definition at line 102 of file OgreMemoryAllocatedObject.h.

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

Definition at line 108 of file OgreMemoryAllocatedObject.h.

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

Definition at line 113 of file OgreMemoryAllocatedObject.h.

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

Definition at line 119 of file OgreMemoryAllocatedObject.h.

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

Definition at line 68 of file OgreMemoryAllocatedObject.h.

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

Definition at line 73 of file OgreMemoryAllocatedObject.h.

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

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

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

Definition at line 86 of file OgreMemoryAllocatedObject.h.

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

Definition at line 91 of file OgreMemoryAllocatedObject.h.

void Ogre::SkeletonInstance::resetToPose ( void  )

Resets the transform of all bones to the binding pose. Manual bones are not reset.

void Ogre::SkeletonInstance::setManualBone ( Bone bone,
bool  isManual 
)

Sets the given node to manual.

Manual bones won't be reset to binding pose (

See also
resetToPose) and thus are suitable for manual control. However if the bone is animated, you're responsible for resetting the position/rotation/scale before each call to
update
Remarks
You can prevent the bone from receiving animation by setting the bone weight to zero. SkeletonAnimation::setBoneWeight
Parameters
boneBone to set/unset to manual. Must belong to this SkeletonInstance (an assert is triggered on non-release builds). Behavior is undefined if node doesn't belong to this instance.
isManualTrue to set to manual, false to restore it.
void Ogre::SkeletonInstance::setParentNode ( Node parentNode)

Sets our parent node so that our bones are in World space.

Iterates through all our bones and sets the root bones

void Ogre::SkeletonInstance::update ( void  )

Member Data Documentation

ActiveAnimationsVec Ogre::SkeletonInstance::mActiveAnimations
protected

Definition at line 85 of file OgreSkeletonInstance.h.

SkeletonAnimationVec Ogre::SkeletonInstance::mAnimations
protected

Definition at line 84 of file OgreSkeletonInstance.h.

BoneVec Ogre::SkeletonInstance::mBones
protected

Definition at line 77 of file OgreSkeletonInstance.h.

TransformArray Ogre::SkeletonInstance::mBoneStartTransforms
protected

Definition at line 78 of file OgreSkeletonInstance.h.

SkeletonDef const* Ogre::SkeletonInstance::mDefinition
protected

Definition at line 87 of file OgreSkeletonInstance.h.

RawSimdUniquePtr<ArrayReal, MEMCATEGORY_ANIMATION> Ogre::SkeletonInstance::mManualBones
protected

The start of Transform at each depth level.

Definition at line 80 of file OgreSkeletonInstance.h.

Node* Ogre::SkeletonInstance::mParentNode
protected

Node this SkeletonInstance is attached to (so we can work in world space)

Definition at line 95 of file OgreSkeletonInstance.h.

FastArray<size_t> Ogre::SkeletonInstance::mSlotStarts
protected

Definition at line 82 of file OgreSkeletonInstance.h.

BoneVec Ogre::SkeletonInstance::mUnusedNodes
protected

Unused slots for each parent depth level that had more bones than >= ARRAY_PACKED_REALS /2 but less than < ARRAY_PACKED_REALS (or a multiple of it)

Definition at line 92 of file OgreSkeletonInstance.h.


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