Index: orxonox/trunk/src/lib/graphics/particles/quick_animation.cc
===================================================================
--- orxonox/trunk/src/lib/graphics/particles/quick_animation.cc	(revision 4415)
+++ orxonox/trunk/src/lib/graphics/particles/quick_animation.cc	(revision 4415)
@@ -0,0 +1,120 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "quick_animation.h"
+
+#include "compiler.h"
+#include "debug.h"
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+QuickAnimation::QuickAnimation (float rangeStart, float valueStart, float rangeEnd, float valueEnd)
+{
+   this->setClassName("QuickAnimation");
+
+   this->first = this->current = new QuickKeyFrame;
+   this->current->positionStart = rangeStart;
+   this->current->positionEnd = rangeEnd;
+   this->current->valueStart = valueStart;
+   this->current->valueEnd = valueEnd;
+   this->current->next = NULL;
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+QuickAnimation::~QuickAnimation () 
+{
+  this->current = this->first;
+  QuickKeyFrame delKF;
+  
+  while (this->current != NULL)
+    {
+      this->first = this->current->next;
+      delete this->current;
+      this->current = this->first;
+    }
+
+}
+
+
+void QuickAnimation::addEntry(float position, float value)
+{
+  this->current = this->first;
+  if (position < this->current->positionStart)
+    {
+      this->current = new QuickKeyFrame;
+
+      this->current->positionStart = position;
+      this->current->positionEnd = this->first->positionStart;
+
+      this->current->valueStart = value;
+      this->current->valueEnd = this->first->valueStart;
+      
+      this->current->next = this->first;
+      this->first = this->current;
+    }
+  
+  while(this->current != NULL)
+    {
+      if (this->current->positionStart < position)
+	{
+	  QuickKeyFrame* tmpKey = new QuickKeyFrame;
+	  tmpKey->positionStart = position;
+	  tmpKey->positionEnd = this->current->positionEnd;
+	  tmpKey->valueStart = value;
+	  tmpKey->valueEnd = this->current->valueEnd;
+	  tmpKey->next = this->current->next;
+	  
+	  this->current->positionEnd = tmpKey->positionStart;
+	  this->current->valueEnd = tmpKey->valueStart;
+	}
+    }
+}
+
+
+float QuickAnimation::getValue(float position)
+{
+  while (likely (this->current->positionStart > position || this->current->positionEnd < position))
+    {
+      if (likely(this->current->next != NULL))
+	this->current = this->current->next;
+      else
+	{
+	  if (unlikely(this->first->positionStart > position))
+	    {
+	      PRINTF(2)("Position out of range. chose %f, min is: %f, max is\n", position, this->first->positionStart, this->current->positionEnd);
+	      return 0;
+	    }
+	  this->current = this->first;
+	}
+    }
+  return this->current->valueStart + (this->current->positionEnd - position) *
+    (this->current->valueEnd - this->current->valueStart) /
+    (this->current->positionEnd - this->current->positionStart);
+}
+
Index: orxonox/trunk/src/lib/graphics/particles/quick_animation.h
===================================================================
--- orxonox/trunk/src/lib/graphics/particles/quick_animation.h	(revision 4415)
+++ orxonox/trunk/src/lib/graphics/particles/quick_animation.h	(revision 4415)
@@ -0,0 +1,51 @@
+/*! 
+    \file quick_animation.h
+    \brief Definition of the QuickAnimation-class
+
+*/
+
+#ifndef _QUICK_ANIMATION_H
+#define _QUICK_ANIMATION_H
+
+#include "base_object.h"
+
+// FORWARD DEFINITION
+
+
+
+
+//! A class for that linearely interpolates between multiple values.
+/**
+   to be quick this only has the capability to store very little date
+
+   this class is optimized for a raising value. eg. 100 particles sorted
+   by age.
+*/
+class QuickAnimation : public BaseObject {
+
+ public:
+  //! a simple struct that stores keyframes for the QuickAnimation-Class.
+  struct QuickKeyFrame
+  {
+    float valueStart;       //!< The starting value of this KeyFrame
+    float valueEnd;         //!< The end value of this KeyFrame
+    float positionStart;    //!< The starting position of this KeyFrame
+    float positionEnd;      //!< The end position of thies KeyFrame
+
+    QuickKeyFrame* next;    //!< The next Animation
+  };
+
+  QuickAnimation(float rangeStart = 0.0, float valueStart = 0.0, float rangeEnd = 1.0, float valueEnd = 0.0);
+  virtual ~QuickAnimation();
+
+  void addEntry(float position, float value);
+
+  float getValue(float position);
+
+ private:
+  QuickKeyFrame* first;
+  QuickKeyFrame* current;
+
+};
+
+#endif /* _QUICK_ANIMATION_H */
