SLProject 4.0.000
|
SLAnimSkeleton keeps track of a skeletons joints and animations. More...
#include <SLAnimSkeleton.h>
Public Member Functions | |
SLAnimSkeleton () | |
~SLAnimSkeleton () | |
SLJoint * | createJoint (SLuint id) |
SLJoint * | createJoint (const SLstring &name, SLuint id) |
SLAnimation * | createAnimation (SLAnimManager &aniMan, const SLstring &name, SLfloat duration) |
void | loadAnimation (const SLstring &file) |
void | addAnimation (SLAnimation *anim) |
void | getJointMatrices (SLVMat4f &jointWM) |
void | reset () |
SLAnimPlayback * | animPlayback (const SLstring &name) |
SLMAnimation | animations () |
SLint | numAnimations () const |
SLJoint * | getJoint (SLuint id) |
SLJoint * | getJoint (const SLstring &name) |
SLint | numJoints () const |
const SLVJoint & | joints () const |
SLJoint * | rootJoint () |
SLbool | changed () const |
const SLVec3f & | minOS () |
const SLVec3f & | maxOS () |
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... | |
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.
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.
SLAnimSkeleton::SLAnimSkeleton | ( | ) |
Constructor
SLAnimSkeleton::~SLAnimSkeleton | ( | ) |
Destructor
void SLAnimSkeleton::addAnimation | ( | SLAnimation * | anim | ) |
|
inline |
SLAnimPlayback * SLAnimSkeleton::animPlayback | ( | const SLstring & | name | ) |
Returns an animation state by name.
|
inline |
|
inline |
SLAnimation * SLAnimSkeleton::createAnimation | ( | SLAnimManager & | aniMan, |
const SLstring & | name, | ||
SLfloat | duration | ||
) |
Create a nw animation owned by this skeleton.
Creates a new joint owned by this skeleton.
Creates a new joint owned by this skeleton with a default name.
void SLAnimSkeleton::getJointMatrices | ( | SLVMat4f & | jointWM | ) |
Fills a SLMat4f array with the final joint matrices for this skeleton.
|
inline |
void SLAnimSkeleton::loadAnimation | ( | const SLstring & | file | ) |
const SLVec3f & SLAnimSkeleton::maxOS | ( | ) |
getter for current the current max object space vertex.
const SLVec3f & SLAnimSkeleton::minOS | ( | ) |
getter for current the current min object space vertex.
|
inline |
|
inline |
void SLAnimSkeleton::reset | ( | ) |
Resets all joints.
|
inline |
|
inline |
Updates the skeleton based on its active animation states
|
protected |
Calculate the current min and max values in local space based on joint radii.
|
protected |
map of animations for this skeleton
|
protected |
map of animation playbacks for this skeleton
|
protected |
did this skeleton change this frame (attribute for skeleton instance)
|
protected |
joint vector for fast access and index to joint mapping
|
protected |
max point in os for this skeleton (attribute for skeleton instance)
|
protected |
dirty flag aabb rebuild
|
protected |
min point in os for this skeleton (attribute for skeleton instance)
|
protected |
pointer to the root joint of skeleton