Index: trunk/src/lib/particles/quick_animation.h
===================================================================
--- trunk/src/lib/particles/quick_animation.h	(revision 5405)
+++ trunk/src/lib/particles/quick_animation.h	(revision 7333)
@@ -8,51 +8,73 @@
 #define _QUICK_ANIMATION_H
 
-#include "base_object.h"
-
+#include <vector>
 // FORWARD DECLARATION
-
-
-
 
 //! A class for that linearely interpolates between multiple values.
 /**
-   to be quick this only has the capability to store very little date
+ * QuickAnimation is a Class that creates a LookupTable with
+ * position between [0.0f - 1.0f] so that one can resolve the
+ * given Value.
+ */
+class QuickAnimation
+{
+public:
+  QuickAnimation(unsigned int resolution = 100);
+  virtual ~QuickAnimation();
 
-   this class is optimized for a raising value. eg. 100 particles sorted
-   by age.
-*/
-class QuickAnimation : public BaseObject {
+  bool addKey(float position, float value);
 
- public:
+  bool changeValueKey(unsigned int keyFrameNumber, float newValue);
+  bool changeValue(float position, float newValue, float region = 0.04f);
 
+  bool removeKey(unsigned int keyFrameNumber);
+  bool remove(float position, float region = 0.04f);
+
+  bool moveKey(unsigned int keyFrameNumber, float newPosition, float newValue);
+  bool moveKey(unsigned int keyFrameNumber, float newPosition);
+  bool move(float oldPosition, float newPosition, float newValue, float region = 0.04f);
+  bool move(float oldPosition, float newPosition, float region = 0.04f);
+
+  int getKeyAt(float position, float region = 0.04f);
+
+  /**
+   * @brief returns the value of the animation at a certain position
+   * @param value returns the calculated value.
+   * @param position The position to get the Value from.
+   */
+  void QuickAnimation::getValue(float& value, float position) const
+  {
+    value = this->lookupValues[int(position*this->lookupValues.size())];
+  }
+
+/**
+   * @brief returns the value of the animation at a certain position
+   * @param position the position to get the value from :)
+   * @returns the calculated Value.
+ */
+  float QuickAnimation::getValue(float position) const
+  {
+    return this->lookupValues[int(position*this->lookupValues.size())];
+  }
+
+  void debug() const;
+private:
+  void rebuild();
+
+private:
   //! a simple struct that stores keyframes for the QuickAnimation-Class.
   struct QuickKeyFrame
   {
-    float            value;             //!< The starting value of this KeyFrame
-    float            position;          //!< The end position of thies KeyFrame
+    //! Creates a new QuickKeyFrame with @param position position @param value value */
+    QuickKeyFrame(float position, float value) :  position(position), value(value) {};
+    float            value;             //!< The value of this KeyFrame
+    float            position;          //!< The position of thies KeyFrame
 
-    QuickKeyFrame*   next;              //!< The next Animation
-    QuickKeyFrame*   prev;              //!< The previous QuickKeyFrame
+    static bool sortPositionPredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
+    static bool sortValuePredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
   };
 
-  QuickAnimation();
-  virtual ~QuickAnimation();
-
-  void addEntry(float position, float value);
-  void changeEntry(float position, float value, float region = .04);
-
-  void removeEntry(float position);
-  /** @todo implemente those functions
-      bool moveEntry(float position);
-  */
-
-  float getValue(float position);
-
-  void debug();
-
- private:
-  QuickKeyFrame*       first;          //!< The first KeyFrame in a Sequence of Keyframes.
-  QuickKeyFrame*       current;        //!< The currently selected KeyFrame.
-  unsigned int         count;          //!< How many Keyframes the QuickAnimation has.
+  std::vector<QuickKeyFrame>    keyFrames;              //!< An Array of KeyFrames.
+  std::vector<float>            lookupValues;           //!< The lookup-table where the values are stored.
 };
 
