Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_SKELETAL_ANIMATION_H__
00009 #define __SP_SKELETAL_ANIMATION_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "SceneGraph/spSceneMesh.hpp"
00014 #include "SceneGraph/Animation/spMeshAnimation.hpp"
00015 #include "SceneGraph/Animation/spAnimationSkeleton.hpp"
00016 #include "SceneGraph/Animation/spAnimationJoint.hpp"
00017 #include "SceneGraph/Animation/spAnimationJointGroup.hpp"
00018 #include "SceneGraph/Animation/spAnimationBaseStructures.hpp"
00019 #include "SceneGraph/Animation/spKeyframeSequence.hpp"
00020
00021 #include <vector>
00022
00023
00024 namespace sp
00025 {
00026 namespace scene
00027 {
00028
00029
00036 class SP_EXPORT SkeletalAnimation : public MeshAnimation
00037 {
00038
00039 public:
00040
00041 SkeletalAnimation();
00042 virtual ~SkeletalAnimation();
00043
00044
00045
00047 AnimationSkeleton* createSkeleton(bool isNewActiveSkeleton = true);
00048
00050 void deleteSkeleton(AnimationSkeleton* Skeleton);
00051
00053 void clearSkeletons();
00054
00061 void addKeyframe(AnimationJoint* Joint, u32 Frame, const Transformation &Transform);
00062
00068 void removeKeyframe(AnimationJoint* Joint, u32 Frame);
00069
00071 void clearKeyframes();
00072
00090 AnimationJointGroup* addJointGroup(const io::stringc &Name = "");
00095 void removeJointGroup(AnimationJointGroup* JointGroup);
00096
00098 void clearJointGroups();
00099
00109 void groupJoint(AnimationJointGroup* Group, AnimationJoint* Joint);
00114 void ungroupJoint(AnimationJointGroup* Group, AnimationJoint* Joint);
00115
00117 AnimationJointGroup* findJointGroup(const io::stringc &Name) const;
00118
00130 bool playGroup(const io::stringc &Name, const EAnimPlaybackModes Mode, u32 FirstFrame, u32 LastFrame);
00132 bool playGroup(const io::stringc &Name, u32 SeqId);
00134 void pauseGroup(const io::stringc &Name, bool isPaused = true);
00136 void stopGroup(const io::stringc &Name);
00137
00150 void poseGroup(const io::stringc &Name, u32 Frame, f32 Interpolation = 0.0f);
00151
00156 virtual void updateAnimation(SceneNode* Node);
00157
00158 virtual u32 getKeyframeCount() const;
00159
00160 virtual void interpolate(u32 IndexFrom, u32 IndexTo, f32 Interpolation);
00161
00162 virtual void interpolateBlended(
00163 const AnimationPlayback &PlaybackFrom, const AnimationPlayback &PlaybackTo, f32 BlendingFactor
00164 );
00165
00166 virtual void copy(const Animation* Other);
00167
00168
00169
00176 inline void setActiveSkeleton(AnimationSkeleton* Skeleton)
00177 {
00178 Skeleton_ = Skeleton;
00179 }
00180
00185 AnimationSkeleton* getActiveSkeleton() const
00186 {
00187 return Skeleton_;
00188 }
00189
00190 private:
00191
00192
00193
00194 void updateJointGroup(AnimationJointGroup* Group, f32 AnimSpeed);
00195
00196
00197
00198 AnimationSkeleton* Skeleton_;
00199 std::list<AnimationSkeleton*> SkeletonList_;
00200
00201 std::list<SJointKeyframe> JointKeyframes_;
00202
00207 std::vector<AnimationJointGroup*> JointGroups_;
00208 std::map<std::string, AnimationJointGroup*> JointGroupsMap_;
00209
00210 };
00211
00212
00213 }
00214
00215 }
00216
00217
00218 #endif
00219
00220
00221
00222