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

Represents the instance of a Skeletal animation based on its definition. More...

#include <OgreSkeletonAnimation.h>

+ Inheritance diagram for Ogre::SkeletonAnimation:

Public Member Functions

 SkeletonAnimation (const SkeletonAnimationDef *definition, const FastArray< size_t > *slotStarts, SkeletonInstance *owner)
 
void _applyAnimation (const TransformArray &boneTransforms)
 
void _boneMemoryRebased (const FastArray< size_t > &oldSlotStarts)
 Shifts the values of mBoneWeights to new locations because the bones' mIndex may have changed.
 
void _initialize (void)
 Internal function that initializes a lot of structures that can't be done in the constructor due to how SkeletonInstance is created/pushed in a vector.
 
void _swapBoneWeightsUniquePtr (RawSimdUniquePtr< ArrayReal, MEMCATEGORY_ANIMATION > &inOutBoneWeights)
 
void addFrame (Real frames)
 Plays the animation forward (or backwards if negative)
 
void addTime (Real time)
 Plays the animation forward (or backwards if negative)
 
Real getBoneWeight (IdString boneName) const
 Gets the current per-bone weight of a particular bone.
 
RealgetBoneWeightPtr (IdString boneName)
 Gets a pointer current per-bone weight of a particular bone.
 
Real getCurrentFrame (void) const
 Gets the current animation frame, in frames.
 
Real getCurrentTime (void) const
 Gets the current animation time, in seconds. Prefer using getCurrentFrame.
 
const SkeletonAnimationDefgetDefinition (void) const
 
Real getDuration (void) const
 Gets animation length, in seconds.
 
bool getEnabled (void) const
 
bool getLoop (void) const
 Returns current loop setting.
 
IdString getName (void) const
 
Real getNumFrames (void) const
 Gets the frame count.
 
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
 
void setBoneWeight (IdString boneName, Real weight)
 Sets the per-bone weight to a particular bone.
 
void setEnabled (bool bEnable)
 Enables or disables this animation. A disabled animation won't be processed at all.
 
void setFrame (Real frame)
 Sets the animation to a particular frame.
 
void setLoop (bool bLoop)
 Loop setting.
 
void setTime (Real time)
 Sets the animation to a particular time.
 

Public Attributes

bool mEnabled
 
Real mFrameRate
 
bool mLoop
 
SkeletonInstancemOwner
 
FastArray< size_t > constmSlotStarts
 
Real mWeight
 

Detailed Description

Represents the instance of a Skeletal animation based on its definition.

Constructor & Destructor Documentation

◆ SkeletonAnimation()

Ogre::SkeletonAnimation::SkeletonAnimation ( const SkeletonAnimationDef definition,
const FastArray< size_t > *  slotStarts,
SkeletonInstance owner 
)

Member Function Documentation

◆ _applyAnimation()

void Ogre::SkeletonAnimation::_applyAnimation ( const TransformArray boneTransforms)

◆ _boneMemoryRebased()

void Ogre::SkeletonAnimation::_boneMemoryRebased ( const FastArray< size_t > &  oldSlotStarts)

Shifts the values of mBoneWeights to new locations because the bones' mIndex may have changed.

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

Parameters
oldSlotStartsArray with the contents old contents of SkeletonInstance::mSlotStarts, one entry per node hirearchy depth level

◆ _initialize()

void Ogre::SkeletonAnimation::_initialize ( void  )

Internal function that initializes a lot of structures that can't be done in the constructor due to how SkeletonInstance is created/pushed in a vector.

If you're not an Ogre dev, don't call this directly.

◆ _swapBoneWeightsUniquePtr()

void Ogre::SkeletonAnimation::_swapBoneWeightsUniquePtr ( RawSimdUniquePtr< ArrayReal, MEMCATEGORY_ANIMATION > &  inOutBoneWeights)

◆ addFrame()

void Ogre::SkeletonAnimation::addFrame ( Real  frames)

Plays the animation forward (or backwards if negative)

Parameters
framesFrames to advance, in frames

◆ addTime()

void Ogre::SkeletonAnimation::addTime ( Real  time)
inline

Plays the animation forward (or backwards if negative)

Parameters
timeTime to advance, in seconds

◆ getBoneWeight()

Real Ogre::SkeletonAnimation::getBoneWeight ( IdString  boneName) const

Gets the current per-bone weight of a particular bone.

Parameters
boneNameThe name of the bone to get. If this animation doesn't affect that bone (or the name is invalid) this function returns 0.
Returns
The weight of the specified bone. 0 if not found.

◆ getBoneWeightPtr()

Real * Ogre::SkeletonAnimation::getBoneWeightPtr ( IdString  boneName)

Gets a pointer current per-bone weight of a particular bone.

Useful if you intend to have read/write access to this value very often.

Remarks
!!! EXTREMELY IMPORTANT !!! If any skeleton instance (that shares the same SkeletonDef) is destroyed, the returned value may be invalidated!

If returnPtr is the return value to bone[0], do not assume that returnPtr+1 affects bone[1] or even any other bone. Doing so the behavior is underfined and most likely you could be affecting the contents of other SkeletonInstances.

Parameters
boneNameThe name of the bone to get. If this animation doesn't affect that bone (or the name is invalid) this function returns a null pointer.
Returns
The pointer to the bone weight of the specified bone. Null pointer if not found.

◆ getCurrentFrame()

Real Ogre::SkeletonAnimation::getCurrentFrame ( void  ) const
inline

Gets the current animation frame, in frames.

◆ getCurrentTime()

Real Ogre::SkeletonAnimation::getCurrentTime ( void  ) const
inline

Gets the current animation time, in seconds. Prefer using getCurrentFrame.

◆ getDefinition()

const SkeletonAnimationDef * Ogre::SkeletonAnimation::getDefinition ( void  ) const
inline

◆ getDuration()

Real Ogre::SkeletonAnimation::getDuration ( void  ) const

Gets animation length, in seconds.

◆ getEnabled()

bool Ogre::SkeletonAnimation::getEnabled ( void  ) const
inline

◆ getLoop()

bool Ogre::SkeletonAnimation::getLoop ( void  ) const
inline

Returns current loop setting.

@See setLoop.

◆ getName()

IdString Ogre::SkeletonAnimation::getName ( void  ) const
inline

◆ getNumFrames()

Real Ogre::SkeletonAnimation::getNumFrames ( void  ) const

Gets the frame count.

◆ 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

◆ setBoneWeight()

void Ogre::SkeletonAnimation::setBoneWeight ( IdString  boneName,
Real  weight 
)

Sets the per-bone weight to a particular bone.

Useful for fine control over animation strength on a set of nodes (i.e. an arm)

Remarks
By default all bone weights are set to 1.0
Parameters
boneNameThe name of the bone to set. If this animation doesn't affect that bone (or the name is invalid) this function does nothing.
weightWeight to apply to this particular bone. Note that the animation multiplies this value against the global mWeight to obtain the final weight. Normal range is between [0; 1] but not necessarily.

◆ setEnabled()

void Ogre::SkeletonAnimation::setEnabled ( bool  bEnable)

Enables or disables this animation. A disabled animation won't be processed at all.

◆ setFrame()

void Ogre::SkeletonAnimation::setFrame ( Real  frame)

Sets the animation to a particular frame.

Parameters
framesFrame to set to, in frames

◆ setLoop()

void Ogre::SkeletonAnimation::setLoop ( bool  bLoop)
inline

Loop setting.

Looped animations will wrap back to zero when reaching the animation length or go back to the animation length if playing backwards. Non-looped animations will stop at the animation length (or at 0 if backwards) but won't be disabled.

◆ setTime()

void Ogre::SkeletonAnimation::setTime ( Real  time)
inline

Sets the animation to a particular time.

Parameters
timeTime to set to, in seconds

Member Data Documentation

◆ mEnabled

bool Ogre::SkeletonAnimation::mEnabled

◆ mFrameRate

Real Ogre::SkeletonAnimation::mFrameRate

◆ mLoop

bool Ogre::SkeletonAnimation::mLoop

◆ mOwner

SkeletonInstance* Ogre::SkeletonAnimation::mOwner

◆ mSlotStarts

FastArray<size_t> const* Ogre::SkeletonAnimation::mSlotStarts

◆ mWeight

Real Ogre::SkeletonAnimation::mWeight

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