Polycode
|
3D skeleton. More...
Inherits Polycode::SceneEntity.
Public Member Functions | |
Skeleton (const String &fileName) | |
Construct skeleton from a skeleton file. | |
void | loadSkeleton (const String &fileName) |
Loads a new skeleton from file. | |
void | playAnimation (const String &animName, bool once=false) |
Play back a loaded animation. | |
void | addAnimation (const String &name, const String &fileName) |
Loads in a new animation from a file and adds it to the skeleton. | |
SkeletonAnimation * | getAnimation (const String &name) const |
Returns a SkeletonAnimation by its name. | |
void | Update () |
Main update method. | |
Bone * | getBoneByName (const String &name) const |
Get bone instance by its name. | |
void | bonesVisible (bool val) |
Toggles bone visibility on and off. | |
void | enableBoneLabels (const String &labelFont, Number size, Number scale, Color labelColor) |
Enables labels with bone names to be rendered. | |
int | getNumBones () const |
Returns the number of bones in the skeleton. | |
Bone * | getBone (int index) const |
Returns a bone at the specified index. | |
SkeletonAnimation * | getCurrentAnimation () const |
Returns the current animation. |
3D skeleton.
Skeletons are applied to scene meshes and can be animated with loaded animations.
Skeleton::Skeleton | ( | const String & | fileName | ) |
Construct skeleton from a skeleton file.
fileName | Skeleton file to load. |
Loads in a new animation from a file and adds it to the skeleton.
name | Name of the new animation. |
fileName | File to load animation from. |
void Skeleton::bonesVisible | ( | bool | val | ) |
Toggles bone visibility on and off.
val | If true, bones will be rendered, if false, they will not. |
void Skeleton::enableBoneLabels | ( | const String & | labelFont, |
Number | size, | ||
Number | scale, | ||
Color | labelColor | ||
) |
Enables labels with bone names to be rendered.
See SceneLabel for details on the parameters.
labelFont | Font to use |
size | Size of font. |
scale | Scale of font. |
labelColor | Color of the label. |
SkeletonAnimation * Skeleton::getAnimation | ( | const String & | name | ) | const |
Returns a SkeletonAnimation by its name.
Name | of animation to return. |
Bone * Skeleton::getBone | ( | int | index | ) | const |
Returns a bone at the specified index.
index | Bone index. |
Get bone instance by its name.
name | Name of the bone. |
void Skeleton::loadSkeleton | ( | const String & | fileName | ) |
Loads a new skeleton from file.
fileName | Skeleton file to load. |
void Skeleton::playAnimation | ( | const String & | animName, |
bool | once = false |
||
) |
Play back a loaded animation.
animName | Name of animation to play. |
once | If true, will only play the animation once. |
void Skeleton::Update | ( | ) | [virtual] |
Main update method.
Override this to do your updates before the render cycle.
Reimplemented from Polycode::Entity.