SLProject
4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
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.
Definition at line 54 of file SLAnimSkeleton.h.
SLAnimSkeleton::SLAnimSkeleton | ( | ) |
Constructor
Definition at line 17 of file SLAnimSkeleton.cpp.
SLAnimSkeleton::~SLAnimSkeleton | ( | ) |
Destructor
Definition at line 27 of file SLAnimSkeleton.cpp.
void SLAnimSkeleton::addAnimation | ( | SLAnimation * | anim | ) |
|
inline |
Definition at line 71 of file SLAnimSkeleton.h.
SLAnimPlayback * SLAnimSkeleton::animPlayback | ( | const SLstring & | name | ) |
|
inline |
Definition at line 78 of file SLAnimSkeleton.h.
Definition at line 84 of file SLAnimSkeleton.h.
SLAnimation * SLAnimSkeleton::createAnimation | ( | SLAnimManager & | aniMan, |
const SLstring & | name, | ||
SLfloat | duration | ||
) |
Creates a new joint owned by this skeleton.
Definition at line 45 of file SLAnimSkeleton.cpp.
Creates a new joint owned by this skeleton with a default name.
Definition at line 36 of file SLAnimSkeleton.cpp.
Returns an SLJoint by it's internal id.
Definition at line 72 of file SLAnimSkeleton.cpp.
Fills a SLMat4f array with the final joint matrices for this skeleton.
Definition at line 89 of file SLAnimSkeleton.cpp.
|
inline |
Definition at line 76 of file SLAnimSkeleton.h.
const SLVec3f & SLAnimSkeleton::maxOS | ( | ) |
getter for current the current max object space vertex.
Definition at line 173 of file SLAnimSkeleton.cpp.
const SLVec3f & SLAnimSkeleton::minOS | ( | ) |
getter for current the current min object space vertex.
Definition at line 163 of file SLAnimSkeleton.cpp.
|
inline |
Definition at line 72 of file SLAnimSkeleton.h.
|
inline |
Definition at line 75 of file SLAnimSkeleton.h.
void SLAnimSkeleton::reset | ( | ) |
Resets all joints.
Definition at line 119 of file SLAnimSkeleton.cpp.
|
inline |
Definition at line 77 of file SLAnimSkeleton.h.
Definition at line 83 of file SLAnimSkeleton.h.
Updates the skeleton based on its active animation states
Definition at line 128 of file SLAnimSkeleton.cpp.
|
protected |
Calculate the current min and max values in local space based on joint radii.
Definition at line 184 of file SLAnimSkeleton.cpp.
|
protected |
map of animations for this skeleton
Definition at line 97 of file SLAnimSkeleton.h.
|
protected |
map of animation playbacks for this skeleton
Definition at line 98 of file SLAnimSkeleton.h.
|
protected |
did this skeleton change this frame (attribute for skeleton instance)
Definition at line 99 of file SLAnimSkeleton.h.
|
protected |
joint vector for fast access and index to joint mapping
Definition at line 96 of file SLAnimSkeleton.h.
|
protected |
max point in os for this skeleton (attribute for skeleton instance)
Definition at line 101 of file SLAnimSkeleton.h.
|
protected |
dirty flag aabb rebuild
Definition at line 102 of file SLAnimSkeleton.h.
|
protected |
min point in os for this skeleton (attribute for skeleton instance)
Definition at line 100 of file SLAnimSkeleton.h.
|
protected |
pointer to the root joint of skeleton
Definition at line 95 of file SLAnimSkeleton.h.