Public Member Functions

sp::scene::SkeletalAnimation Class Reference
[Animation System]

#include <spSkeletalAnimation.hpp>

Inheritance diagram for sp::scene::SkeletalAnimation:
sp::scene::MeshAnimation sp::scene::Animation

List of all members.

Public Member Functions

 SkeletalAnimation ()
virtual ~SkeletalAnimation ()
AnimationSkeletoncreateSkeleton (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.
AnimationJointGroupaddJointGroup (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)
AnimationJointGroupfindJointGroup (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)
AnimationSkeletongetActiveSkeleton () const

Detailed Description

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.


Constructor & Destructor Documentation

sp::scene::SkeletalAnimation::SkeletalAnimation (  ) 
sp::scene::SkeletalAnimation::~SkeletalAnimation (  )  [virtual]

Member Function Documentation

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.

Parameters:
[in] Name Specifies the group name.
Returns:
Pointer to the new AnimationJointGroup object.
See also:
groupJoint
playGroup
pauseGroup
stopGroup
Note:
Joint groups are separately stored in a hash-map for faster access. But new joint groups will only be inserted to this map if the name is unique. Otherwise this new joint-group can not be used for the comfort functions "playGroup", "pauseGroup" and "stopGroup". In that case you have to use the pointers and work with the objects directly.
void sp::scene::SkeletalAnimation::addKeyframe ( AnimationJoint Joint,
u32  Frame,
const Transformation Transform 
)

Adds a new keyframe for the specified joint.

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

Returns:
Pointer to the new animation object.
Note:
You have to delete this pointer by yourself!

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.

See also:
setActiveSkeleton
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.

Parameters:
[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.
See also:
addJointGroup
AnimationSkeleton
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').

See also:
findJointGroup
AnimationPlayback
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.

See also:
addJointGroup
void sp::scene::SkeletalAnimation::removeKeyframe ( AnimationJoint Joint,
u32  Frame 
)

Removes the keyframe for the specified joint.

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

See also:
groupJoint
void sp::scene::SkeletalAnimation::updateAnimation ( SceneNode Node  )  [virtual]

Updates the skeletal animation. If the animation is playing all keyframes will be performed.

Parameters:
[in] Object This must be a Mesh scene node. Otherwise the function will do nothing.

Implements sp::scene::Animation.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines