00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef SO3ANIM_H
00036 #define SO3ANIM_H
00037
00038 #include "..\SCOLBasic\SO3Std.h"
00039 #include "..\SCOLBasic\SO3DataScol.h"
00040
00041 namespace SO3
00042 {
00043
00044 class SAnim : public SData
00045 {
00046 public:
00047 enum AnimType
00048 {
00049 SO3_UNKNOWN_ANIM = 0,
00050 SO3_SCENENODE_ANIM = 1,
00051 SO3_SKELETAL_ANIM = 2,
00052 SO3_VERTEX_ANIM = 3,
00053 SO3_FAP_ANIM = 4,
00054 SO3_POSE_ANIM = 5,
00055 SO3_SEQUENCE_ANIM = 6
00056 };
00057 enum AnimInterpolationMode
00058 {
00059 SO3_IM_LINEAR,
00060 SO3_IM_SPLINE
00061 };
00062 enum AnimRotationInterpolationMode
00063 {
00064 SO3_RIM_LINEAR,
00065 SO3_RIM_SPHERICAL
00066 };
00067 protected:
00068 Ogre::Animation* ogreAnimation;
00069 SAnimTrackList animationTrackList;
00070 SScene* mScene;
00071 private:
00072 SAnimationFrameListener* ogreAnimationFrameListener;
00073 const AnimType type;
00074 float mSpeed;
00075 float mWeight;
00076 bool mLoop;
00077 bool isPaused;
00078 bool skipFrame;
00079 SNode* associatedNode;
00080 unsigned short animationIndex;
00081 unsigned short bUpdatedBySequence;
00082 public:
00083
00084
00087 ~SAnim();
00088
00091 Ogre::Animation* GetOgreAnimationPointer();
00092
00095 SNode* GetParentNode();
00096
00099 SScene* GetParentScene();
00100
00103 AnimType GetType();
00104
00107 bool IsSequenceUpdated();
00108
00111 void SetSequenceUpdated(bool value);
00112
00115 unsigned short GetIndex();
00116
00121 SAnimTrack* CreateAnimationTrack(std::string newAnimationTrackName);
00122
00129 void DeleteAnimationTrack(SAnimTrack* existingAnimationTrack);
00130
00133 unsigned short GetNumAnimationsTracks();
00134
00137 SAnimTrack* GetAnimationTrack(unsigned short index);
00138
00141 SAnimTrackList GetAnimationsTracks() const;
00142
00145 void SetLength(float length);
00146
00149 float GetLength();
00150
00153 virtual void SetTimePosition(float timePosition);
00154
00157 float GetTimePosition();
00158
00161 void Apply(float timePosition);
00162
00165 virtual void SetWeight(float weight);
00166
00169 virtual float GetWeight();
00170
00173 void SetInitialWeight(float weight);
00174
00177 float GetInitialWeight();
00178
00181 void SetInitialLoop(bool loop);
00182
00185 bool GetInitialLoop();
00186
00189 void SetInterpolationMode(AnimInterpolationMode interpolationMode);
00190
00193 AnimInterpolationMode GetInterpolationMode();
00194
00197 void SetRotationInterpolationMode(AnimRotationInterpolationMode interpolationMode);
00198
00201 AnimRotationInterpolationMode GetRotationInterpolationMode();
00202
00205 virtual void SetEnable(bool enable);
00206
00209 bool GetEnable();
00210
00213 void SetLoop(bool loop);
00214
00217 bool GetLoop();
00218
00221 bool SkipFrame();
00222
00225 void SetSkipFrame(bool state);
00226
00229 void SetOptimise(bool optimize);
00230
00234
00235
00238 void SetSpeed(float newSpeed);
00239
00242 float GetSpeed();
00243
00246 bool HasEnded();
00247
00250 void AddTime(float time);
00251
00254 void SetPaused(bool pauseState);
00255
00258 bool GetPaused();
00259
00263 virtual void _UpdateImpl(const Ogre::FrameEvent &evt);
00264 protected:
00267 SAnim(SScene* scene, std::string animationName, SNode* animationAssociatedNode, unsigned short animationId, AnimType animationType);
00268
00272 void AddAnimationTrack(SAnimTrack* existingAnimationTrack);
00273
00277 void RemoveAnimationTrack(SAnimTrack* existingAnimationTrack);
00278
00282 virtual SAnimTrack* CreateAnimationTrackImpl(std::string newAnimationTrackName);
00283
00288 virtual Ogre::AnimationState* _GetOgreAnimationState() = 0;
00289 private:
00293 SAnim();
00294 };
00295
00296 class SAnimationFrameListener : public Ogre::FrameListener
00297 {
00298 public:
00299 protected:
00300 private:
00301 SAnim* animation;
00302
00303 public:
00306 SAnimationFrameListener(SAnim* animationListened);
00307
00310 ~SAnimationFrameListener();
00311
00315 bool frameStarted(const Ogre::FrameEvent& evt);
00316 protected:
00317 private:
00318 };
00319
00320 }
00321
00322 #endif