/*! \file simple_animation.h \brief A class to interpolate the movement of an object following descrete points in room and time \todo implement it This class has been done to animate some movement, works best for short distances. */ #ifndef _SIMPLE_ANIMATION_H #define _SIMPLE_ANIMATION_H #include "base_object.h" #include "list.h" class Vector; class Quaternion; class WorldEntity; class PNode; typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC}; typedef enum animationMode{SINGLE=0, LOOP}; #define DEFAULT_ANIMATION_MODE LINEAR //! KeyFrame Struct /** This represents one point with direction of the animation */ typedef struct KeyFrame { Vector* position; Quaternion* direction; WorldEntity* object; float time; movementMode mode; }; //! Animation Struct /** This represents an animation for a object */ typedef struct Animation { WorldEntity* object; KeyFrame* currentFrame; KeyFrame* lastFrame; Vector* lastPosition; Vector* tmpVect; tList* frames; animationMode animMode; movementMode movMode; bool bRunning; float deltaT; float localTime; }; //! Animation Class /** Helps you making some small animation */ class SimpleAnimation : public BaseObject { public: static SimpleAnimation* getInstance(); void animatorBegin(); void animatorEnd(); void selectObject(WorldEntity* entity); void addKeyFrame(Vector* point, Quaternion* direction, float time); void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode); void addKeyFrame(KeyFrame* frame); void reset(); void start(); void stop(); void restart(); void pause(); void resume(); void tick(float time); private: SimpleAnimation(); virtual ~SimpleAnimation(); static SimpleAnimation* singletonRef; bool bDescriptive; //* frames; //* animators; //