#include <spSkeletalAnimation.hpp>
Public Member Functions | |
SkeletalAnimation () | |
virtual | ~SkeletalAnimation () |
AnimationSkeleton * | createSkeleton (bool isNewActiveSkeleton=true) |
Creates a new skeleton and sets by default this to the new active one. | |
void | deleteSkeleton (AnimationSkeleton *Skeleton) |
Deletes the specified skeleton if it was created by this animation. | |
void | clearSkeletons () |
Deletes all skeletons. | |
void | addKeyframe (AnimationJoint *Joint, u32 Frame, const Transformation &Transform) |
void | removeKeyframe (AnimationJoint *Joint, u32 Frame) |
void | clearKeyframes () |
Clears the animation keyframes for all animation joints. | |
AnimationJointGroup * | addJointGroup (const io::stringc &Name="") |
void | removeJointGroup (AnimationJointGroup *JointGroup) |
void | clearJointGroups () |
Clears (or rather removes) all joint groups. | |
void | groupJoint (AnimationJointGroup *Group, AnimationJoint *Joint) |
void | ungroupJoint (AnimationJointGroup *Group, AnimationJoint *Joint) |
AnimationJointGroup * | findJointGroup (const io::stringc &Name) const |
Returns a pointer to the first joint-group with the specified name. | |
bool | playGroup (const io::stringc &Name, const EAnimPlaybackModes Mode, u32 FirstFrame, u32 LastFrame) |
bool | playGroup (const io::stringc &Name, u32 SeqId) |
Plays the specified joint-group's animatio sequence. | |
void | pauseGroup (const io::stringc &Name, bool isPaused=true) |
Pauses the specified joint-group playback. | |
void | stopGroup (const io::stringc &Name) |
Stops the specified joint-group playback. | |
void | poseGroup (const io::stringc &Name, u32 Frame, f32 Interpolation=0.0f) |
virtual void | updateAnimation (SceneNode *Node) |
virtual u32 | getKeyframeCount () const |
Returns the count of keyframes. | |
virtual void | interpolate (u32 IndexFrom, u32 IndexTo, f32 Interpolation) |
Makes an interpolation between the two given frames. | |
virtual void | interpolateBlended (const AnimationPlayback &PlaybackFrom, const AnimationPlayback &PlaybackTo, f32 BlendingFactor) |
Makes an blended interpolation between the two given playback states. This can be used for 'animation blending'. | |
virtual void | copy (const Animation *Other) |
void | setActiveSkeleton (AnimationSkeleton *Skeleton) |
AnimationSkeleton * | getActiveSkeleton () const |
Skeletal animation class. An skeletal animation consists primary of a skeleton (AnimationSkeleton object) and joint keyframes. This skeleton consits of joints (AnimationJoint objects) and theses joints have their own vertex weights information i.e. data which describes how a vertex will be influenced by each joint.
sp::scene::SkeletalAnimation::SkeletalAnimation | ( | ) |
sp::scene::SkeletalAnimation::~SkeletalAnimation | ( | ) | [virtual] |
AnimationJointGroup * sp::scene::SkeletalAnimation::addJointGroup | ( | const io::stringc & | Name = "" |
) |
Adds a new joint group. Joint groups are not stored in the skeleton because it deals more with animation playback than skeleton construction. Joint groups can be used to animate several bone groups parallel, e.g. let a character's legs be animated while the arms are transformed procedural.
[in] | Name | Specifies the group name. |
void sp::scene::SkeletalAnimation::addKeyframe | ( | AnimationJoint * | Joint, | |
u32 | Frame, | |||
const Transformation & | Transform | |||
) |
Adds a new keyframe for the specified joint.
[in] | Joint | Specifies the joint which is to be affected by that keyframe. |
[in] | Frame | Specifies the frame index. For each joint a frame index may be used only once. |
[in] | Transform | Specifies the transformation for this keyframe. |
void sp::scene::SkeletalAnimation::clearJointGroups | ( | ) |
Clears (or rather removes) all joint groups.
void sp::scene::SkeletalAnimation::clearKeyframes | ( | ) | [virtual] |
Clears the animation keyframes for all animation joints.
Implements sp::scene::Animation.
void sp::scene::SkeletalAnimation::clearSkeletons | ( | ) |
Deletes all skeletons.
void sp::scene::SkeletalAnimation::copy | ( | const Animation * | Other | ) | [virtual] |
Copies the whole animation.
Implements sp::scene::Animation.
AnimationSkeleton * sp::scene::SkeletalAnimation::createSkeleton | ( | bool | isNewActiveSkeleton = true |
) |
Creates a new skeleton and sets by default this to the new active one.
void sp::scene::SkeletalAnimation::deleteSkeleton | ( | AnimationSkeleton * | Skeleton | ) |
Deletes the specified skeleton if it was created by this animation.
AnimationJointGroup * sp::scene::SkeletalAnimation::findJointGroup | ( | const io::stringc & | Name | ) | const |
Returns a pointer to the first joint-group with the specified name.
AnimationSkeleton* sp::scene::SkeletalAnimation::getActiveSkeleton | ( | ) | const [inline] |
Returns the active skeleton.
u32 sp::scene::SkeletalAnimation::getKeyframeCount | ( | ) | const [virtual] |
Returns the count of keyframes.
Implements sp::scene::Animation.
void sp::scene::SkeletalAnimation::groupJoint | ( | AnimationJointGroup * | Group, | |
AnimationJoint * | Joint | |||
) |
Inserts the specified joint to the specified joint-group.
[in] | Group | Specifies the pointer to the joint-group object. This must be created previously with the "addJointGroup" function. |
[in] | Joint | Specifies the pointer to the joint object. Joints can only be created with the skeleton. |
void sp::scene::SkeletalAnimation::interpolate | ( | u32 | IndexFrom, | |
u32 | IndexTo, | |||
f32 | Interpolation | |||
) | [virtual] |
Makes an interpolation between the two given frames.
Implements sp::scene::Animation.
void sp::scene::SkeletalAnimation::interpolateBlended | ( | const AnimationPlayback & | PlaybackFrom, | |
const AnimationPlayback & | PlaybackTo, | |||
f32 | BlendingFactor | |||
) | [virtual] |
Makes an blended interpolation between the two given playback states. This can be used for 'animation blending'.
Reimplemented from sp::scene::Animation.
void sp::scene::SkeletalAnimation::pauseGroup | ( | const io::stringc & | Name, | |
bool | isPaused = true | |||
) |
Pauses the specified joint-group playback.
bool sp::scene::SkeletalAnimation::playGroup | ( | const io::stringc & | Name, | |
const EAnimPlaybackModes | Mode, | |||
u32 | FirstFrame, | |||
u32 | LastFrame | |||
) |
Starts playing the specified joint-group. This is just a comfort function. The behaviour is equivalent to the following code:
AnimationJointGroup* MyBodyJointGroup = MySkeletalAnimation->findJointGroup(Name);
if (MyBodyJointGroup)
MyBodyJointGroup->getPlayback().play(Mode, FirstFrame, LastFrmae);
This is analog to the other "...Group" functions (like 'play', 'pause' and 'stop').
bool sp::scene::SkeletalAnimation::playGroup | ( | const io::stringc & | Name, | |
u32 | SeqId | |||
) |
Plays the specified joint-group's animatio sequence.
void sp::scene::SkeletalAnimation::poseGroup | ( | const io::stringc & | Name, | |
u32 | Frame, | |||
f32 | Interpolation = 0.0f | |||
) |
Sets the joint-group's pose. This is equivalent to the following code:
AnimationJointGroup* MyBodyJointGroup = MySkeletalAnimation->findJointGroup(Name);
if (MyBodyJointGroup)
{
MyBodyJointGroup->getPlayback().stop();
MyBodyJointGroup->getPlayback().setFrame(Frame);
MyBodyJointGroup->getPlayback().setInterpolation(Interpolation);
}
void sp::scene::SkeletalAnimation::removeJointGroup | ( | AnimationJointGroup * | JointGroup | ) |
Removes the specified joint-group object.
void sp::scene::SkeletalAnimation::removeKeyframe | ( | AnimationJoint * | Joint, | |
u32 | Frame | |||
) |
Removes the keyframe for the specified joint.
[in] | Joint | Specifies the joint for which the keyframe is to be removed. |
[in] | Frame | Specifies the frame index at which position the keyframe is to be removed. |
TODO! -> this is not correct!!!
void sp::scene::SkeletalAnimation::setActiveSkeleton | ( | AnimationSkeleton * | Skeleton | ) | [inline] |
Sets the new skeleton for this skeletal animation. You can create a skeleton only for this animation (use SkeletalAnimation::createSkeleton). And you can use a skeleton from another animation but then you need to remove the skeleton yourself before this other animation will be deleted!
void sp::scene::SkeletalAnimation::stopGroup | ( | const io::stringc & | Name | ) |
Stops the specified joint-group playback.
void sp::scene::SkeletalAnimation::ungroupJoint | ( | AnimationJointGroup * | Group, | |
AnimationJoint * | Joint | |||
) |
Ungroups a joint from a joint-group.
void sp::scene::SkeletalAnimation::updateAnimation | ( | SceneNode * | Node | ) | [virtual] |
Updates the skeletal animation. If the animation is playing all keyframes will be performed.
[in] | Object | This must be a Mesh scene node. Otherwise the function will do nothing. |
Implements sp::scene::Animation.