This documents an old version of bs::framework. Click here to see the latest release.
Skeleton Class Reference

Description

Contains information about bones required for skeletal animation.

Allows caller to evaluate a set of animation clips at a specific time and output the relevant skeleton pose.

Inherits IReflectable.

Methods

void getPose (Matrix4 *pose, LocalSkeletonPose &localPose, const SkeletonMask &mask, const AnimationClip &clip, float time, bool loop=true)
 Outputs a skeleton pose containing required transforms for transforming the skeleton to the values specified by the provided animation clip evaluated at the specified time. More...
 
void getPose (Matrix4 *pose, LocalSkeletonPose &localPose, const SkeletonMask &mask, const AnimationStateLayer *layers, UINT32 numLayers)
 Outputs a skeleton pose containing required transforms for transforming the skeleton to the values specified by the provided set of animation curves. More...
 
UINT32 getNumBones () const
 Returns the total number of bones in the skeleton. More...
 
const SkeletonBoneInfogetBoneInfo (UINT32 idx) const
 Returns information about a bone at the provided index. More...
 
UINT32 getRootBoneIndex () const
 Searches all bones to find a root bone. More...
 
const Matrix4getInvBindPose (UINT32 idx) const
 Returns the inverse bind pose for the bone at the provided index. More...
 
Transform calcBoneTransform (UINT32 idx) const
 Calculates the bind-pose transform of the bone at the specified index. More...
 
RTTITypeBasegetRTTI () const override
 Returns an interface you can use to access class' Run Time Type Information. More...
 
- Methods inherited from IReflectable
bool isDerivedFrom (RTTITypeBase *base)
 Returns true if current RTTI class is derived from base (Or if it is the same type as base). More...
 
UINT32 getTypeId () const
 Returns an unique type identifier of the class. More...
 
const StringgetTypeName () const
 Returns the type name of the class. More...
 

Static methods

static SPtr< Skeletoncreate (BONE_DESC *bones, UINT32 numBones)
 Creates a new Skeleton. More...
 
static RTTITypeBasegetRTTIStatic ()
 
static SPtr< SkeletoncreateEmpty ()
 Creates a Skeleton with no data. More...
 
- Static methods inherited from IReflectable
static UnorderedMap< UINT32, RTTITypeBase * > & getAllRTTITypes ()
 Returns all available RTTI types. More...
 
static SPtr< IReflectablecreateInstanceFromTypeId (UINT32 rttiTypeId)
 Creates an empty instance of a class from a type identifier. More...
 
static void _registerRTTIType (RTTITypeBase *rttiType)
 Called by each type implementing RTTITypeBase, on program load. More...
 
static RTTITypeBase_getRTTIfromTypeId (UINT32 rttiTypeId)
 Returns class' RTTI type from type id. More...
 
static bool _isTypeIdDuplicate (UINT32 typeId)
 Checks if the provided type id is unique. More...
 
static void _checkForCircularReferences ()
 Iterates over all RTTI types and reports any circular references (for example one type having a field referencing another type, and that type having a field referencing the first type). More...
 
static RTTITypeBasegetRTTIStatic ()
 Returns an interface you can use to access class' Run Time Type Information. More...
 

Method documentation

◆ calcBoneTransform()

Transform calcBoneTransform ( UINT32  idx) const

Calculates the bind-pose transform of the bone at the specified index.

◆ create()

static SPtr<Skeleton> create ( BONE_DESC bones,
UINT32  numBones 
)
static

Creates a new Skeleton.

Parameters
[in]bonesAn array of bones to initialize the skeleton with. Data will be copied.
[in]numBonesNumber of bones in the bones array.

◆ createEmpty()

static SPtr<Skeleton> createEmpty ( )
static

Creates a Skeleton with no data.

You must populate its data manually.

Note
For serialization use only.

◆ getBoneInfo()

const SkeletonBoneInfo& getBoneInfo ( UINT32  idx) const

Returns information about a bone at the provided index.

◆ getInvBindPose()

const Matrix4& getInvBindPose ( UINT32  idx) const

Returns the inverse bind pose for the bone at the provided index.

◆ getNumBones()

UINT32 getNumBones ( ) const

Returns the total number of bones in the skeleton.

◆ getPose() [1/2]

void getPose ( Matrix4 pose,
LocalSkeletonPose localPose,
const SkeletonMask mask,
const AnimationClip clip,
float  time,
bool  loop = true 
)

Outputs a skeleton pose containing required transforms for transforming the skeleton to the values specified by the provided animation clip evaluated at the specified time.

Parameters
[out]poseOutput pose containing the requested transforms. Must be pre-allocated with enough space to hold all the bone matrices of this skeleton.
[in]maskMask that filters which skeleton bones are enabled or disabled.
[out]localPoseOutput pose containing the local transforms. Must be pre-allocated with enough space to hold all the bone data of this skeleton.
[in]clipClip to evaluate.
[in]timeTime to evaluate the clip with.
[in]loopDetermines should the time be looped (wrapped) if it goes past the clip start/end.
Note
It is more efficient to use the other getPose overload as sequential calls can benefit from animation evaluator cache.

◆ getPose() [2/2]

void getPose ( Matrix4 pose,
LocalSkeletonPose localPose,
const SkeletonMask mask,
const AnimationStateLayer layers,
UINT32  numLayers 
)

Outputs a skeleton pose containing required transforms for transforming the skeleton to the values specified by the provided set of animation curves.

Parameters
[out]poseOutput pose containing the requested transforms. Must be pre-allocated with enough space to hold all the bone matrices of this skeleton.
[in]maskMask that filters which skeleton bones are enabled or disabled.
[out]localPoseOutput pose containing the local transforms. Must be pre-allocated with enough space to hold all the bone data of this skeleton.
[in]layersOne or multiple layers, containing one or multiple animation states to evaluate.
[in]numLayersNumber of layers in the layers array.

◆ getRootBoneIndex()

UINT32 getRootBoneIndex ( ) const

Searches all bones to find a root bone.

Returns -1 if no root can be found.

◆ getRTTI()

RTTITypeBase* getRTTI ( ) const
overridevirtual

Returns an interface you can use to access class' Run Time Type Information.

Note

You must derive your own version of RTTITypeBase, in which you may encapsulate all reflection specific operations.

Implements IReflectable.