| 1 | /*! |
|---|
| 2 | * @file quick_animation.h |
|---|
| 3 | * Definition of the QuickAnimation-class |
|---|
| 4 | |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef _QUICK_ANIMATION_H |
|---|
| 8 | #define _QUICK_ANIMATION_H |
|---|
| 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| 11 | |
|---|
| 12 | // FORWARD DECLARATION |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | |
|---|
| 17 | //! A class for that linearely interpolates between multiple values. |
|---|
| 18 | /** |
|---|
| 19 | to be quick this only has the capability to store very little date |
|---|
| 20 | |
|---|
| 21 | this class is optimized for a raising value. eg. 100 particles sorted |
|---|
| 22 | by age. |
|---|
| 23 | */ |
|---|
| 24 | class QuickAnimation : public BaseObject { |
|---|
| 25 | |
|---|
| 26 | public: |
|---|
| 27 | |
|---|
| 28 | //! a simple struct that stores keyframes for the QuickAnimation-Class. |
|---|
| 29 | struct QuickKeyFrame |
|---|
| 30 | { |
|---|
| 31 | float value; //!< The starting value of this KeyFrame |
|---|
| 32 | float position; //!< The end position of thies KeyFrame |
|---|
| 33 | |
|---|
| 34 | QuickKeyFrame* next; //!< The next Animation |
|---|
| 35 | QuickKeyFrame* prev; //!< The previous QuickKeyFrame |
|---|
| 36 | }; |
|---|
| 37 | |
|---|
| 38 | QuickAnimation(); |
|---|
| 39 | virtual ~QuickAnimation(); |
|---|
| 40 | |
|---|
| 41 | void addEntry(float position, float value); |
|---|
| 42 | void changeEntry(float position, float value, float region = .04); |
|---|
| 43 | |
|---|
| 44 | void removeEntry(float position); |
|---|
| 45 | /** @todo implemente those functions |
|---|
| 46 | bool moveEntry(float position); |
|---|
| 47 | */ |
|---|
| 48 | |
|---|
| 49 | float getValue(float position); |
|---|
| 50 | |
|---|
| 51 | void debug(); |
|---|
| 52 | |
|---|
| 53 | private: |
|---|
| 54 | QuickKeyFrame* first; //!< The first KeyFrame in a Sequence of Keyframes. |
|---|
| 55 | QuickKeyFrame* current; //!< The currently selected KeyFrame. |
|---|
| 56 | unsigned int count; //!< How many Keyframes the QuickAnimation has. |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | #endif /* _QUICK_ANIMATION_H */ |
|---|