SLProject 4.0.000
SLAnimSkeleton Class Reference

SLAnimSkeleton keeps track of a skeletons joints and animations. More...

#include <SLAnimSkeleton.h>

Public Member Functions

 SLAnimSkeleton ()
 
 ~SLAnimSkeleton ()
 
SLJointcreateJoint (SLuint id)
 
SLJointcreateJoint (const SLstring &name, SLuint id)
 
SLAnimationcreateAnimation (SLAnimManager &aniMan, const SLstring &name, SLfloat duration)
 
void loadAnimation (const SLstring &file)
 
void addAnimation (SLAnimation *anim)
 
void getJointMatrices (SLVMat4f &jointWM)
 
void reset ()
 
SLAnimPlaybackanimPlayback (const SLstring &name)
 
SLMAnimation animations ()
 
SLint numAnimations () const
 
SLJointgetJoint (SLuint id)
 
SLJointgetJoint (const SLstring &name)
 
SLint numJoints () const
 
const SLVJointjoints () const
 
SLJointrootJoint ()
 
SLbool changed () const
 
const SLVec3fminOS ()
 
const SLVec3fmaxOS ()
 
void rootJoint (SLJoint *joint)
 
void changed (SLbool changed)
 
SLbool updateAnimations (SLfloat elapsedTimeSec)
 

Protected Member Functions

void updateMinMax ()
 

Protected Attributes

SLJoint_rootJoint
 pointer to the root joint of skeleton More...
 
SLVJoint _joints
 joint vector for fast access and index to joint mapping More...
 
SLMAnimation _animations
 map of animations for this skeleton More...
 
SLMAnimPlayback _animPlaybacks
 map of animation playbacks for this skeleton More...
 
SLbool _changed
 did this skeleton change this frame (attribute for skeleton instance) More...
 
SLVec3f _minOS
 min point in os for this skeleton (attribute for skeleton instance) More...
 
SLVec3f _maxOS
 max point in os for this skeleton (attribute for skeleton instance) More...
 
SLbool _minMaxOutOfDate
 dirty flag aabb rebuild More...
 

Detailed Description

SLAnimSkeleton keeps track of a skeletons joints and animations.

An SLAnimSkeleton is used to animate a hierarchical object like a human being. An SLAnimSkeleton keeps track of its bones (SLJoints) in a tree structure and points with _root to the root node of the skeleton hierarchy. An SLAnimSkeleton is not actively transforming any SLNode in the scenegraph. It just keeps track of its transformed SLJoint. A mesh that is associated with a skeleton transforms all its vertices every frame by the joint weights. Every vertex of a mesh has weights for four joints by which it can be influenced.

SLAnimations for this skeleton are also kept in this class. The SLAnimations have tracks corresponding to the individual SLJoints in the skeleton.

Note
The current implementation doesn't support multiple instances of the same skeleton animation. It is however not that far away from supporting it. Currently the SLAnimSkeleton class keeps both a SLAnimation map and an SLAnimPlayback map. We can split this into two classes by creating an SLSkeletonInstance class we that keeps the SLAnimPlayback map that references its parent SLAnimSkeleton we would be able to create multiple SLSkeletonInstance instances that use the same SLAnimations but with different states.

This leaves the problem of SLMesh that is not able to be instantiated without copying the data into a completely separate SLMesh. But the solution for SLMesh would take the same approach by creating a mesh instance class that is able to use SLSkeletonInstance.

Note
The current version of the SLAssimpImporter only supports the loading of a single animation. This limitation is mainly because there are very few 3D programs that make use of the possibility to export multiple animations in a single file. This means we would need to extend our importer to be able to load more animations for an already loaded skeleton.

Constructor & Destructor Documentation

◆ SLAnimSkeleton()

SLAnimSkeleton::SLAnimSkeleton ( )

Constructor

◆ ~SLAnimSkeleton()

SLAnimSkeleton::~SLAnimSkeleton ( )

Destructor

Member Function Documentation

◆ addAnimation()

void SLAnimSkeleton::addAnimation ( SLAnimation anim)

◆ animations()

SLMAnimation SLAnimSkeleton::animations ( )
inline

◆ animPlayback()

SLAnimPlayback * SLAnimSkeleton::animPlayback ( const SLstring name)

Returns an animation state by name.

◆ changed() [1/2]

SLbool SLAnimSkeleton::changed ( ) const
inline

◆ changed() [2/2]

void SLAnimSkeleton::changed ( SLbool  changed)
inline

◆ createAnimation()

SLAnimation * SLAnimSkeleton::createAnimation ( SLAnimManager aniMan,
const SLstring name,
SLfloat  duration 
)

Create a nw animation owned by this skeleton.

◆ createJoint() [1/2]

SLJoint * SLAnimSkeleton::createJoint ( const SLstring name,
SLuint  id 
)

Creates a new joint owned by this skeleton.

◆ createJoint() [2/2]

SLJoint * SLAnimSkeleton::createJoint ( SLuint  id)

Creates a new joint owned by this skeleton with a default name.

◆ getJoint() [1/2]

SLJoint * SLAnimSkeleton::getJoint ( const SLstring name)

returns an SLJoint by name.

◆ getJoint() [2/2]

SLJoint * SLAnimSkeleton::getJoint ( SLuint  id)

Returns an SLJoint by it's internal id.

◆ getJointMatrices()

void SLAnimSkeleton::getJointMatrices ( SLVMat4f jointWM)

Fills a SLMat4f array with the final joint matrices for this skeleton.

◆ joints()

const SLVJoint & SLAnimSkeleton::joints ( ) const
inline

◆ loadAnimation()

void SLAnimSkeleton::loadAnimation ( const SLstring file)

◆ maxOS()

const SLVec3f & SLAnimSkeleton::maxOS ( )

getter for current the current max object space vertex.

◆ minOS()

const SLVec3f & SLAnimSkeleton::minOS ( )

getter for current the current min object space vertex.

◆ numAnimations()

SLint SLAnimSkeleton::numAnimations ( ) const
inline

◆ numJoints()

SLint SLAnimSkeleton::numJoints ( ) const
inline

◆ reset()

void SLAnimSkeleton::reset ( )

Resets all joints.

◆ rootJoint() [1/2]

SLJoint * SLAnimSkeleton::rootJoint ( )
inline

◆ rootJoint() [2/2]

void SLAnimSkeleton::rootJoint ( SLJoint joint)
inline

◆ updateAnimations()

SLbool SLAnimSkeleton::updateAnimations ( SLfloat  elapsedTimeSec)

Updates the skeleton based on its active animation states

◆ updateMinMax()

void SLAnimSkeleton::updateMinMax ( )
protected

Calculate the current min and max values in local space based on joint radii.

Member Data Documentation

◆ _animations

SLMAnimation SLAnimSkeleton::_animations
protected

map of animations for this skeleton

◆ _animPlaybacks

SLMAnimPlayback SLAnimSkeleton::_animPlaybacks
protected

map of animation playbacks for this skeleton

◆ _changed

SLbool SLAnimSkeleton::_changed
protected

did this skeleton change this frame (attribute for skeleton instance)

◆ _joints

SLVJoint SLAnimSkeleton::_joints
protected

joint vector for fast access and index to joint mapping

◆ _maxOS

SLVec3f SLAnimSkeleton::_maxOS
protected

max point in os for this skeleton (attribute for skeleton instance)

◆ _minMaxOutOfDate

SLbool SLAnimSkeleton::_minMaxOutOfDate
protected

dirty flag aabb rebuild

◆ _minOS

SLVec3f SLAnimSkeleton::_minOS
protected

min point in os for this skeleton (attribute for skeleton instance)

◆ _rootJoint

SLJoint* SLAnimSkeleton::_rootJoint
protected

pointer to the root joint of skeleton


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