Polycode
Polycode::Skeleton Class Reference

3D skeleton. More...

Inherits Polycode::SceneEntity.

List of all members.

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.
SkeletonAnimationgetAnimation (const String &name) const
 Returns a SkeletonAnimation by its name.
void Update ()
 Main update method.
BonegetBoneByName (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.
BonegetBone (int index) const
 Returns a bone at the specified index.
SkeletonAnimationgetCurrentAnimation () const
 Returns the current animation.

Detailed Description

3D skeleton.

Skeletons are applied to scene meshes and can be animated with loaded animations.


Constructor & Destructor Documentation

Skeleton::Skeleton ( const String fileName)

Construct skeleton from a skeleton file.

Parameters:
fileNameSkeleton file to load.

Member Function Documentation

void Skeleton::addAnimation ( const String name,
const String fileName 
)

Loads in a new animation from a file and adds it to the skeleton.

Parameters:
nameName of the new animation.
fileNameFile to load animation from.
void Skeleton::bonesVisible ( bool  val)

Toggles bone visibility on and off.

Parameters:
valIf 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.

Parameters:
labelFontFont to use
sizeSize of font.
scaleScale of font.
labelColorColor of the label.
SkeletonAnimation * Skeleton::getAnimation ( const String name) const

Returns a SkeletonAnimation by its name.

Parameters:
Nameof animation to return.
Bone * Skeleton::getBone ( int  index) const

Returns a bone at the specified index.

Parameters:
indexBone index.
Bone * Skeleton::getBoneByName ( const String name) const

Get bone instance by its name.

Parameters:
nameName of the bone.
void Skeleton::loadSkeleton ( const String fileName)

Loads a new skeleton from file.

Parameters:
fileNameSkeleton file to load.
void Skeleton::playAnimation ( const String animName,
bool  once = false 
)

Play back a loaded animation.

Parameters:
animNameName of animation to play.
onceIf 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.