Index: /branches/new_class_id/configure.ac
===================================================================
--- /branches/new_class_id/configure.ac	(revision 9757)
+++ /branches/new_class_id/configure.ac	(revision 9758)
@@ -624,5 +624,4 @@
                  src/lib/event/Makefile
                  src/lib/physics/Makefile
-                 src/lib/particles/Makefile
                  src/lib/collision_detection/Makefile
                  src/lib/collision_reaction/Makefile
Index: /branches/new_class_id/src/Makefile.am
===================================================================
--- /branches/new_class_id/src/Makefile.am	(revision 9757)
+++ /branches/new_class_id/src/Makefile.am	(revision 9758)
@@ -37,8 +37,4 @@
 		orxonox.cc \
 		\
-		lib/particles/model_particles.cc \
-		lib/particles/spark_particles.cc \
-		lib/particles/sprite_particles.cc \
-		lib/particles/plane_emitter.cc \
 		lib/graphics/effects/fog_effect.cc \
 		lib/graphics/effects/volfog_effect.cc \
Index: /branches/new_class_id/src/defs/include_paths.am
===================================================================
--- /branches/new_class_id/src/defs/include_paths.am	(revision 9757)
+++ /branches/new_class_id/src/defs/include_paths.am	(revision 9758)
@@ -13,5 +13,4 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/spatial_separation
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/render2D
-AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/particles
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui/gl
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui/gl/glmenu
Index: /branches/new_class_id/src/lib/BuildLibs.am
===================================================================
--- /branches/new_class_id/src/lib/BuildLibs.am	(revision 9757)
+++ /branches/new_class_id/src/lib/BuildLibs.am	(revision 9758)
@@ -6,5 +6,4 @@
                 $(LIB_PREFIX)/gui/libORXbasegui.a \
                 $(LIB_PREFIX)/graphics/libORXgraphics.a \
-                $(LIB_PREFIX)/particles/libORXparticles.a \
                 $(LIB_PREFIX)/collision_detection/libORXcd.a \
                 $(LIB_PREFIX)/collision_reaction/libORXcr.a \
Index: /branches/new_class_id/src/lib/Makefile.am
===================================================================
--- /branches/new_class_id/src/lib/Makefile.am	(revision 9757)
+++ /branches/new_class_id/src/lib/Makefile.am	(revision 9758)
@@ -25,5 +25,4 @@
 	event \
 	physics \
-	particles \
 	collision_detection \
 	collision_reaction \
Index: /branches/new_class_id/src/lib/graphics/effects/rain_effect.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/effects/rain_effect.cc	(revision 9757)
+++ /branches/new_class_id/src/lib/graphics/effects/rain_effect.cc	(revision 9758)
@@ -24,6 +24,6 @@
 #include "p_node.h"
 #include "state.h"
-#include "spark_particles.h"
-#include "plane_emitter.h"
+#include "particles/spark_particles.h"
+#include "particles/plane_emitter.h"
 #include "shell_command.h"
 #include "light.h"
Index: /branches/new_class_id/src/lib/graphics/effects/rain_effect.h
===================================================================
--- /branches/new_class_id/src/lib/graphics/effects/rain_effect.h	(revision 9757)
+++ /branches/new_class_id/src/lib/graphics/effects/rain_effect.h	(revision 9758)
@@ -13,5 +13,5 @@
 #include <string>
 
-#include "particle_system.h"
+#include "particles/particle_system.h"
 
 class SparkParticles;
Index: /branches/new_class_id/src/lib/graphics/effects/snow_effect.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/effects/snow_effect.cc	(revision 9757)
+++ /branches/new_class_id/src/lib/graphics/effects/snow_effect.cc	(revision 9758)
@@ -24,6 +24,6 @@
 #include "p_node.h"
 #include "state.h"
-#include "sprite_particles.h"
-#include "plane_emitter.h"
+#include "particles/sprite_particles.h"
+#include "particles/plane_emitter.h"
 #include "shell_command.h"
 #include "script_class.h"
Index: /branches/new_class_id/src/lib/graphics/effects/snow_effect.h
===================================================================
--- /branches/new_class_id/src/lib/graphics/effects/snow_effect.h	(revision 9757)
+++ /branches/new_class_id/src/lib/graphics/effects/snow_effect.h	(revision 9758)
@@ -7,5 +7,5 @@
 
 #include "vector.h"
-#include "particle_system.h"
+#include "particles/particle_system.h"
 #include "material.h"
 #include "vector2D.h"
Index: /branches/new_class_id/src/lib/physics/physics_connection.cc
===================================================================
--- /branches/new_class_id/src/lib/physics/physics_connection.cc	(revision 9757)
+++ /branches/new_class_id/src/lib/physics/physics_connection.cc	(revision 9758)
@@ -22,5 +22,5 @@
 
 #include "field.h"
-#include "particle_system.h"
+#include "particles/particle_system.h"
 #include "physics_interface.h"
 
Index: /branches/new_class_id/src/lib/util/loading/resource.h
===================================================================
--- /branches/new_class_id/src/lib/util/loading/resource.h	(revision 9757)
+++ /branches/new_class_id/src/lib/util/loading/resource.h	(revision 9758)
@@ -49,4 +49,6 @@
   };
 
+
+
 public:
   Resource(const std::string& fileName);
Index: /branches/new_class_id/src/world_entities/WorldEntities.am
===================================================================
--- /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9757)
+++ /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9758)
@@ -72,5 +72,22 @@
                 world_entities/effects/lightning_bolt.cc \
                 \
-                world_entities/script_trigger.cc
+                world_entities/script_trigger.cc \
+                \
+                \
+                world_entities/particles/particle_emitter.cc \
+		world_entities/particles/dot_emitter.cc \
+		world_entities/particles/box_emitter.cc \
+		world_entities/particles/plane_emitter.cc \
+		\
+		world_entities/particles/particle_system.cc \
+		world_entities/particles/sprite_particles.cc \
+		world_entities/particles/spark_particles.cc \
+		world_entities/particles/model_particles.cc \
+		world_entities/particles/dot_particles.cc \
+		\
+		world_entities/particles/quick_animation.cc
+
+
+
 
 
@@ -144,3 +161,18 @@
                 effects/lightning_bolt.h \
                 \
-                script_trigger.h
+                script_trigger.h \
+                \
+                \
+		particles/particle_emitter.h \
+		particles/dot_emitter.h \
+		particles/box_emitter.h \
+		particles/plane_emitter.h \
+		\
+		particles/particle_system.h \
+		particles/sprite_particles.h \
+		particles/spark_particles.h \
+		particles/model_particles.h \
+		particles/dot_particles.h \
+		\
+		particles/quick_animation.h
+
Index: /branches/new_class_id/src/world_entities/effects/explosion.cc
===================================================================
--- /branches/new_class_id/src/world_entities/effects/explosion.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/effects/explosion.cc	(revision 9758)
@@ -22,6 +22,6 @@
 #include "state.h"
 
-#include "box_emitter.h"
-#include "sprite_particles.h"
+#include "particles/box_emitter.h"
+#include "particles/sprite_particles.h"
 
 
Index: /branches/new_class_id/src/world_entities/particles/Makefile.am
===================================================================
--- /branches/new_class_id/src/world_entities/particles/Makefile.am	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/Makefile.am	(revision 9758)
@@ -0,0 +1,33 @@
+MAINSRCDIR=../..
+include $(MAINSRCDIR)/defs/include_paths.am
+
+noinst_LIBRARIES = libORXparticles.a
+
+libORXparticles_a_SOURCES = \
+			particle_emitter.cc \
+			dot_emitter.cc \
+			box_emitter.cc \
+			plane_emitter.cc \
+			\
+			particle_system.cc \
+			sprite_particles.cc \
+			spark_particles.cc \
+			model_particles.cc \
+			dot_particles.cc \
+			\
+			quick_animation.cc
+
+
+noinst_HEADERS = \
+			particle_emitter.h \
+			dot_emitter.h \
+			box_emitter.h \
+			plane_emitter.h \
+			\
+			particle_system.h \
+			sprite_particles.h \
+			spark_particles.h \
+			model_particles.h \
+			dot_particles.h \
+			\
+			quick_animation.h
Index: /branches/new_class_id/src/world_entities/particles/box_emitter.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/box_emitter.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/box_emitter.cc	(revision 9758)
@@ -0,0 +1,117 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "box_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(BoxEmitter, CL_BOX_EMITTER);
+CREATE_FACTORY(BoxEmitter);
+
+/**
+ *  standard constructor
+*/
+BoxEmitter::BoxEmitter(const Vector& size, float emissionRate, float velocity, float angle)
+    :  ParticleEmitter(emissionRate, velocity, angle)
+{
+  this->init();
+  this->setSize(size);
+}
+
+/**
+ *  constructs and loads a BoxEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+BoxEmitter::BoxEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+BoxEmitter::~BoxEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void BoxEmitter::init()
+{
+  this->registerObject(this, BoxEmitter::_objectList);
+  this->setSize(1.0f,1.0f,1.0f);
+}
+
+void BoxEmitter::loadParams(const TiXmlElement* root)
+{
+  ParticleEmitter::loadParams(root);
+
+  LoadParam(root, "size", this, BoxEmitter, setSize)
+  .describe("The Size of the BoxEmitter: x, y, z")
+  .defaultValues(1.0f,1.0f,1.0f);
+}
+
+void BoxEmitter::setSize(float x, float y, float z)
+{
+  this->size = Vector (x,y,z);
+}
+
+
+void BoxEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  Vector xDir = this->getAbsDirX() * this->size.x;
+  Vector yDir = this->getAbsDirY() * this->size.y;
+  Vector zDir = this->getAbsDirZ() * this->size.z;
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->getAbsDirX());
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    Vector box = this->getAbsCoor() +
+                 xDir * ((float)rand()/RAND_MAX -.5) +
+                 yDir * ((float)rand()/RAND_MAX -.5) +
+                 zDir * ((float)rand()/RAND_MAX -.5);
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(box, velocityV, orient, moment);
+
+  }
+}
Index: /branches/new_class_id/src/world_entities/particles/box_emitter.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/box_emitter.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/box_emitter.h	(revision 9758)
@@ -0,0 +1,46 @@
+/*!
+ * @file box_emitter.h
+ *  Definition of a BoxEmitter
+ */
+
+#ifndef _BOX_EMITTER_H
+#define _BOX_EMITTER_H
+
+#include "particle_emitter.h"
+
+#define BOX_EMITTER_DEFAULT_SIZE Vector(1.0f, 1.0f, 1.0f)
+
+//! A class to handle a Box Emitter.
+/**
+ * A Box Emitter is a special kind of emitter, that has the (underlying) PNode
+ * at its center, and from there on is a Box in the Direction of the PNode
+ * out around size in the corresponding directions
+ */
+class BoxEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(BoxEmitter);
+  friend class ParticleSystem;
+public:
+  BoxEmitter(const Vector& size = BOX_EMITTER_DEFAULT_SIZE,
+             float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+             float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+             float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  BoxEmitter(const TiXmlElement* root);
+  virtual ~BoxEmitter();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setSize(float x, float y, float z);
+  void setSize(const Vector& size) { this->setSize(size.x, size.y, size.z); };
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+
+private:
+  Vector      size;
+};
+
+#endif /* _BOX_EMITTER_H */
Index: /branches/new_class_id/src/world_entities/particles/dot_emitter.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/dot_emitter.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/dot_emitter.cc	(revision 9758)
@@ -0,0 +1,93 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "dot_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(DotEmitter, CL_DOT_EMITTER);
+CREATE_FACTORY(DotEmitter);
+
+/**
+ *  standard constructor
+*/
+DotEmitter::DotEmitter(float emissionRate, float velocity, float angle)
+    : ParticleEmitter( emissionRate, velocity, angle)
+{
+  this->init();
+}
+
+/**
+ *  constructs and loads a DotEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+DotEmitter::DotEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+DotEmitter::~DotEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void DotEmitter::init()
+{
+  this->registerObject(this, DotEmitter::_objectList);
+}
+
+void DotEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->getAbsDirX());
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(this->getAbsCoor() + this->getVelocity()*.1*rand()/RAND_MAX,
+                                   velocityV, orient, moment);
+
+  }
+}
Index: /branches/new_class_id/src/world_entities/particles/dot_emitter.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/dot_emitter.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/dot_emitter.h	(revision 9758)
@@ -0,0 +1,29 @@
+/*!
+ * @file dot_emitter.h
+ *  Definition of a DotEmitter
+ */
+
+#ifndef _DOT_EMITTER_H
+#define _DOT_EMITTER_H
+
+#include "particle_emitter.h"
+
+//! A class to handle an Emitter.
+class DotEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(DotEmitter);
+
+  friend class ParticleSystem;
+public:
+  DotEmitter(float emissionRate = 1.0, float velocity = 1.0, float angle = .5);
+  DotEmitter(const TiXmlElement* root);
+  virtual ~DotEmitter();
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+};
+
+#endif /* _DOT_EMITTER_H */
Index: /branches/new_class_id/src/world_entities/particles/dot_particles.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/dot_particles.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/dot_particles.cc	(revision 9758)
@@ -0,0 +1,118 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "dot_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES);
+CREATE_FACTORY(DotParticles);
+
+SHELL_COMMAND(texture, DotParticles, setMaterialTexture)
+    ->defaultValues("maps/evil-flower.png");
+
+
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the DotParticles
+*/
+DotParticles::DotParticles (unsigned int maxCount)
+  : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+DotParticles::DotParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+DotParticles::~DotParticles()
+{ }
+
+/**
+ * @brief initializes the DotParticles with default values
+*/
+void DotParticles::init()
+{
+  this->registerObject(this, DotParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void DotParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, DotParticles, setMaterialTexture);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void DotParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+
+  glMatrixMode(GL_MODELVIEW);
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  Particle* drawPart = particles;
+  //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+  glBegin(GL_POINTS);
+  while (likely(drawPart != NULL))
+  {
+    glColor4fv(drawPart->color);
+    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+
+    drawPart = drawPart->next;
+  }
+  glEnd();
+  glPopAttrib();
+}
Index: /branches/new_class_id/src/world_entities/particles/dot_particles.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/dot_particles.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/dot_particles.h	(revision 9758)
@@ -0,0 +1,38 @@
+/*!
+ * @file dot_particles.h
+
+*/
+
+#ifndef _DOT_PARTICLE_SYSTEM_H
+#define _DOT_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class DotParticles : public ParticleSystem
+{
+  ObjectListDeclaration(DotParticles);
+
+public:
+  DotParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  DotParticles(const TiXmlElement* root);
+  virtual ~DotParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const std::string& textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _DOT_PARTICLE_SYSTEM_H */
Index: /branches/new_class_id/src/world_entities/particles/engine/particle_engine.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/engine/particle_engine.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/engine/particle_engine.cc	(revision 9758)
@@ -0,0 +1,454 @@
+/*
+   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_GRAPHICS
+
+#include "particle_engine.h"
+
+#include "class_list.h"
+
+#include "debug.h"
+#include "stdlibincl.h"
+#include "util/loading/load_param.h"
+
+
+
+/**
+ *  standard constructor
+*/
+ParticleEngine::ParticleEngine ()
+{
+   this->setClassID(CL_PARTICLE_ENGINE, "ParticleEngine");
+   this->setName("ParticleEngine");
+
+   this->systemList = new tList<ParticleSystem>;
+   this->emitterList = new tList<ParticleEmitter>;
+   this->connectionList = new tList<ParticleConnection>;
+}
+
+/**
+ *  the singleton reference to this class
+*/
+ParticleEngine* ParticleEngine::singletonRef = NULL;
+
+/**
+ *  deletes all the system, emitters, connections and Lists
+*/
+ParticleEngine::~ParticleEngine ()
+{
+  /// @todo we must not do this, because PNoe does it for us
+  /// or we do this with help from ClassList, which essentially makes much more sense
+
+  // delete all remaining systems
+//   tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
+//   ParticleSystem* tmpSys = sysIt->firstElement();
+//   while(tmpSys)
+//     {
+//       delete tmpSys;
+//       tmpSys = sysIt->nextElement();
+//     }
+//   delete sysIt;
+   delete this->systemList;
+//
+   // delete all remaining emitters
+   tIterator<ParticleEmitter>* emitIt = this->emitterList->getIterator();
+   ParticleEmitter* tmpEmit = emitIt->firstElement();
+   while(tmpEmit)
+     {
+       delete tmpEmit;
+       tmpEmit = emitIt->nextElement();
+     }
+   delete emitIt;
+   delete this->emitterList;
+
+  // there should be no more Connections
+  if (this->connectionList->getSize() == 0)
+    delete this->connectionList;
+  else
+    PRINTF(2)("The Connection List is not empty. This should not happen.\n");
+
+  ParticleEngine::singletonRef = NULL;
+}
+
+/**
+  \brief loads the ParticleEngines settings and connections between particles and emitters
+* @param root the XML-element to load this from.
+ */
+void ParticleEngine::loadParams(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    LoadParam_CYCLE(element, "connect", this, ParticleEngine, addConnection)
+        .describe("connects an Emitter to a System (emitterName, systemName)");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ *  Adds a System to the System list.
+
+   this is done automatically when creating a ParticleSystem
+*/
+void ParticleEngine::addSystem(ParticleSystem* system)
+{
+  this->systemList->add(system);
+}
+
+/**
+ *  Adds an emitter to the emitterList
+
+   this is done automatically when creating a ParticleEmitter
+*/
+void ParticleEngine::addEmitter(ParticleEmitter* emitter)
+{
+  this->emitterList->add(emitter);
+}
+
+/**
+* @brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+* @param emitter the Emitter to connect to the System
+* @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(const std::string& emitter, const std::string& system)
+{
+  ParticleEmitter* tmpEmit = dynamic_cast<ParticleEmitter*>(ClassList::getObject(emitter, CL_PARTICLE_EMITTER));//this->getEmitterByName(emitter);
+  ParticleSystem* tmpSys = dynamic_cast<ParticleSystem*>(ClassList::getObject(system, CL_PARTICLE_SYSTEM));//this->getSystemByName(system);
+
+  if (tmpEmit != NULL && tmpSys != NULL)
+    this->addConnection(tmpEmit, tmpSys);
+  else
+  {
+    if (tmpEmit == NULL)
+      PRINTF(2)("Emitter %s not found in the List of emitters, not connecting to %s\n", emitter.c_str(), system.c_str());
+    if (tmpEmit == NULL)
+      PRINTF(2)("System %s not found in the List of emitters, not connecting to %s\n", system.c_str(), emitter.c_str());
+  }
+}
+
+/**
+ *  Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
+ * @param emitter the Emitter to connect to the System
+ * @param system the System to connect to the Emitter
+*/
+void ParticleEngine::addConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+        {
+          PRINTF(2)("Connection between Emitter and System already exists.\n");
+          delete tmpConIt;
+          return;
+        }
+
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+
+
+  ParticleConnection* tmpCon = new ParticleConnection;
+  tmpCon->emitter = emitter;
+  tmpCon->system = system;
+
+  this->connectionList->add(tmpCon);
+}
+
+/**
+ *  Removes a system from the systemList and also removes all Connections to the System
+ * @param system The ParticleSystem to delete
+*/
+bool ParticleEngine::removeSystem(ParticleSystem* system)
+{
+  // remove any connections, that have this system within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->system == system)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the System from the systemList.
+  this->systemList->remove(system);
+}
+
+/**
+ *  removes an emitter from the emitterList and also from all Connections it is attached to.
+ * @param emitter the ParticleEmitter to remove.
+*/
+bool ParticleEngine::removeEmitter(ParticleEmitter* emitter)
+{
+  // remove any connections, that have this emitter within
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection != NULL)
+    {
+      if (tmpConnection->emitter == emitter)
+        this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the emitter from the emitterList
+  this->emitterList->remove(emitter);
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param connection the connection to remove
+ *
+ * \see bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+ */
+bool ParticleEngine::breakConnection(ParticleConnection* connection)
+{
+  this->connectionList->remove(connection);
+  return true;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connection to remove
+ * @param system The system of the connection to remove
+ * @returns true, if the connection was broken, false if the conntection was not found
+ *
+ * only if both system and emitter are in the connection the Connection will be broken
+*/
+bool ParticleEngine::breakConnection(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+      {
+        this->breakConnection(tmpConnection);
+        delete tmpConIt;
+        return true;
+      }
+    tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+  return false;
+}
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param emitter The emitter of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleEmitter* emitter)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->emitter == emitter)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+
+/**
+ *  removes a Connection between an Emitter and a System
+ * @param system The system of the connections to remove
+ * @returns the count of connections that were broken, 0 if no conntection was not found
+ */
+unsigned int ParticleEngine::breakConnections(ParticleSystem* system)
+{
+  unsigned int retVal = 0;
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+  {
+    if (tmpConnection->system == system)
+    {
+      this->breakConnection(tmpConnection);
+      retVal++;
+    }
+    tmpConnection = tmpConIt->nextElement();
+  }
+  delete tmpConIt;
+  return retVal;
+}
+
+/**
+ *  this function ticks all the ParticleSystems, so an animation will flow
+ * @param dt passed since last tick
+*/
+void ParticleEngine::tick(float dt)
+{
+  // ticks all the ParticleSystems
+//   tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+//   ParticleSystem* tmpSys = tmpIt->firstElement();
+//   while(tmpSys)
+//     {
+//       tmpSys->tick(dt);
+//       tmpSys = tmpIt->nextElement();
+//     }
+//   delete tmpIt;
+
+  // add new Particles to each System connected to an Emitter.
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->firstElement();
+  while(tmpConnection)
+    {
+      tmpConnection->emitter->tick(dt, tmpConnection->system);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+}
+
+/**
+ *  draws all the systems and their Particles.
+*/
+void ParticleEngine::draw() const
+{
+  /*
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      tmpSys->draw();
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;*/
+
+}
+
+/**
+ * @param number the n-th system to return
+ * @returns the system called by number or NULL if not found
+*/
+ParticleSystem* ParticleEngine::getSystemByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->firstElement();
+  while(tmpSys)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpSys;
+        }
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ * @param number the n-th emitter to return
+ * @returns the emitter called by number or NULL if not found
+*/
+ParticleEmitter* ParticleEngine::getEmitterByNumber(unsigned int number) const
+{
+  int count = 0;
+  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+  ParticleEmitter* tmpEmit = tmpIt->firstElement();
+  while(tmpEmit)
+    {
+      count++;
+      if ( count == number)
+        {
+          delete tmpIt;
+          return tmpEmit;
+        }
+      tmpEmit = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleEngine::debug()
+{
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)("+ PARTICLE-ENGINE DEBUG INFORMATION +\n");
+  PRINT(0)("+-----------------------------------+\n");
+  PRINT(0)(" Reference: %p\n", ParticleEngine::singletonRef);
+  PRINT(0)(" Count: Emitters: %d; Systems: %d, Connections: %d\n",
+  this->emitterList->getSize(), this->systemList->getSize(), this->connectionList->getSize());
+
+  if (this->connectionList->getSize() > 0)
+  {
+    PRINT(0)(" Connections:\n");
+    PRINT(0)(" -----------------------------------\n");
+
+    tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+    ParticleConnection* tmpConnection = tmpConIt->firstElement();
+    while(tmpConnection)
+    {
+      PRINT(0)(" Emitter '%s' emitts into System '%s'\n", tmpConnection->emitter->getName(), tmpConnection->system->getName());
+      tmpConnection = tmpConIt->nextElement();
+    }
+    delete tmpConIt;
+  }
+
+  if (this->systemList->getSize() > 0)
+  {
+    tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+    ParticleSystem* tmpSys = tmpIt->firstElement();
+    while(tmpSys)
+    {
+      tmpSys->debug();
+      tmpSys = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINT(0)("NO SYSTEMS\n");
+  }
+  if (this->emitterList->getSize() > 0)
+  {
+    tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+    ParticleEmitter* tmpEmit = tmpIt->firstElement();
+    while(tmpEmit)
+    {
+      tmpEmit->debug();
+      tmpEmit = tmpIt->nextElement();
+    }
+    delete tmpIt;
+  }
+  else
+  {
+    PRINTF(0)("NO EMITTERS\n");
+  }
+
+  PRINT(0)("+--------------------------------PE-+\n");
+
+}
+
Index: /branches/new_class_id/src/world_entities/particles/engine/particle_engine.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/engine/particle_engine.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/engine/particle_engine.h	(revision 9758)
@@ -0,0 +1,72 @@
+/*!
+ * @file particle_engine.h
+  *  Definition of the ParticleEngine
+*/
+
+#ifndef _PARTICLE_ENGINE_H
+#define _PARTICLE_ENGINE_H
+
+#include "base_object.h"
+
+#include "particle_system.h"
+#include "particle_emitter.h"
+#include <list>
+
+#include "parser/tinyxml/tinyxml.h"
+
+// FORWARD DECLARATION
+
+//! A ParticleConnection enables us to emitt from any emitter into any other particleSystem
+typedef struct ParticleConnection
+{
+  ParticleEmitter*    emitter;     //!< The emitter to emit system from.
+  ParticleSystem*     system;      //!< The Particles emitted from emitter.
+};
+
+//! The physicsEngine handles and stores Systems and Emitters.
+/**
+   It is responsible for driving on the Particles (tick)
+   It draw particles (draw)
+   and it emitts particles into the system
+*/
+class ParticleEngine : public BaseObject {
+
+ public:
+  virtual ~ParticleEngine();
+  /** @returns a Pointer to the only object of this Class */
+  inline static ParticleEngine* getInstance() { if (!singletonRef) singletonRef = new ParticleEngine();  return singletonRef; };
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void tick(float dt);
+  void draw() const;
+
+  void addSystem(ParticleSystem* system);
+  void addEmitter(ParticleEmitter* emitter);
+  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  void addConnection(const std::string& emitter, const std::string& system);
+
+
+  bool removeSystem(ParticleSystem* system);
+  bool removeEmitter(ParticleEmitter* emitter);
+  bool breakConnection(ParticleConnection* connection);
+  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  unsigned int breakConnections(ParticleEmitter* emitter);
+  unsigned int breakConnections(ParticleSystem* system);
+
+   ParticleSystem* getSystemByNumber(unsigned int number) const;
+   ParticleEmitter* getEmitterByNumber(unsigned int number) const;
+
+  void debug();
+
+ private:
+  ParticleEngine();
+  static ParticleEngine* singletonRef;        //!< The reference to the engine.
+
+  std::list<ParticleSystem> systemList;          //!< A list of Systems handled by the ParticleEngine.
+  std::list<ParticleEmitter> emitterList;        //!< A list of Emitters handled by the ParticleEngine.
+
+  tList<ParticleConnection>* connectionList;  //!< A list of Connections between Systems and Emitters.
+};
+
+#endif /* _PARTICLE_ENGINE_H */
Index: /branches/new_class_id/src/world_entities/particles/model_particles.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/model_particles.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/model_particles.cc	(revision 9758)
@@ -0,0 +1,140 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "model_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(ModelParticles, CL_MODEL_PARTICLES);
+CREATE_FACTORY(ModelParticles);
+
+SHELL_COMMAND(texture, ModelParticles, setMaterialTexture)
+->defaultValues("maps/evil-flower.png");
+
+
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the ModelParticles
+*/
+ModelParticles::ModelParticles (unsigned int maxCount)
+    : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+ModelParticles::ModelParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+ModelParticles::~ModelParticles()
+{ }
+
+/**
+ * @brief initializes the ModelParticles with default values
+*/
+void ModelParticles::init()
+{
+  this->registerObject(this, ModelParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void ModelParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, ModelParticles, setMaterialTexture);
+}
+
+/**
+ * @brief sets the Texutre that is placed onto the particles
+ * @param textureFile the Texture to load onto these ModelParticles
+ */
+void ModelParticles::setMaterialTexture(const std::string& textureFile)
+{
+  this->material.setDiffuseMap(textureFile);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void ModelParticles::draw() const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+  Particle* drawPart = particles;
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+  glMatrixMode(GL_MODELVIEW);
+
+  this->material.select();
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+  if (likely(this->getModel() != NULL))
+    while (likely(drawPart != NULL))
+    {
+      glPushMatrix();
+      glMatrixMode(GL_MODELVIEW);
+      /* move */
+      glTranslatef(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+      /* scale */
+      glScalef(drawPart->radius, drawPart->radius, drawPart->radius);
+      /* rotate */
+      Vector tmpRot = drawPart->orientation.getSpacialAxis();
+      glRotatef (drawPart->orientation.getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+
+      this->getModel()->draw();
+
+      glPopMatrix();
+      drawPart = drawPart->next;
+    }
+  else
+    PRINTF(2)("no model loaded onto ParticleSystem-%s\n", this->getCName());
+  glPopAttrib();
+}
Index: /branches/new_class_id/src/world_entities/particles/model_particles.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/model_particles.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/model_particles.h	(revision 9758)
@@ -0,0 +1,38 @@
+/*!
+ * @file model_particles.h
+
+*/
+
+#ifndef _MODEL_PARTICLE_SYSTEM_H
+#define _MODEL_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class ModelParticles : public ParticleSystem
+{
+  ObjectListDeclaration(ModelParticles);
+
+public:
+  ModelParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  ModelParticles(const TiXmlElement* root);
+  virtual ~ModelParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const std::string& textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _MODEL_PARTICLE_SYSTEM_H */
Index: /branches/new_class_id/src/world_entities/particles/particle_emitter.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/particle_emitter.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/particle_emitter.cc	(revision 9758)
@@ -0,0 +1,201 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "particle_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "debug.h"
+
+ObjectListDefinition(ParticleEmitter);
+
+/**
+ *  standard constructor
+*/
+ParticleEmitter::ParticleEmitter(float emissionRate, float velocity, float angle)
+{
+  this->registerObject(this, ParticleEmitter::_objectList);
+
+  this->system = NULL;
+
+  this->setInheritSpeed(PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED);
+  this->setEmissionMomentum(0);
+  this->setSpread(angle);
+  this->setEmissionRate(emissionRate);
+  this->setEmissionVelocity(velocity);
+
+  this->saveTime = 0.0;
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+ParticleEmitter::~ParticleEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+ *  loads a ParticleEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+void ParticleEmitter::loadParams(const TiXmlElement* root)
+{
+  PNode::loadParams(root);
+
+  LoadParam(root, "rate", this, ParticleEmitter, setEmissionRate)
+    .describe("How many particles should be emittet from this emitter");
+
+  LoadParam(root, "inherit-speed", this, ParticleEmitter, setInheritSpeed)
+    .describe("the extent, the speed of the emitter has on the particles");
+
+  LoadParam(root, "emission-velocity", this, ParticleEmitter, setEmissionVelocity)
+    .describe("How fast the particles are emittet (their initial speed)");
+
+  LoadParam(root, "emission-momentum", this, ParticleEmitter, setEmissionMomentum)
+      .describe("How fast the particles rotation is at emissiontime (their initial momentum)");
+
+  LoadParam(root, "spread", this, ParticleEmitter, setSpread)
+    .describe("The angle the particles are emitted from (angle, deviation)");
+}
+
+void ParticleEmitter::setSystem(ParticleSystem* system)
+{
+  if (system != NULL)
+    system->addEmitter(this);
+  else if (this->system != NULL)
+    this->system->removeEmitter(this);
+}
+
+/**
+ *  this start the emitter
+*/
+void ParticleEmitter::start() {}
+
+
+/**
+ *  this stops the emitter
+*/
+void ParticleEmitter::stop() {}
+
+
+/**
+ *  set the emission rate
+ * @param emissionRate: sets the number of particles emitted per second
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setEmissionRate(float emissionRate)
+{
+  if (emissionRate > 0.0)
+    this->emissionRate = emissionRate;
+  else
+    this->emissionRate = 0.0;
+}
+
+/**
+ *  how much of the speed from the ParticleEmitter should flow onto the ParticleSystem
+ * @param value a Value between zero and one
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setInheritSpeed(float value)
+{
+  if (unlikely(value > 1.0))
+    this->inheritSpeed = 1;
+  else if (unlikely(value < 0.0))
+    this->inheritSpeed = 0;
+  else
+    this->inheritSpeed = value;
+}
+
+/**
+ *  set the angle of the emitter
+ * @param angle around the direction in which there are particles to be emitted
+ * @param randomAngle A random spread-angle, the +- randomness of this option
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setSpread(float angle, float randomAngle)
+{
+  this->angle = angle;
+  this->randomAngle = randomAngle;
+}
+
+/**
+ *  sets the initial velocity of all particles emitted
+ * @param velocity The starting velocity of the emitted particles
+ * @param randomVelocity A random starting velocity, the +- randomness of this option
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::setEmissionVelocity(float velocity, float randomVelocity)
+{
+  this->velocity = velocity;
+  this->randomVelocity = randomVelocity;
+}
+
+/**
+ *  sets the initial Momentum of all particles emitted
+ * @param momentum the new Momentum (just a float for being not too complicated).
+ * @param randomMomentum variation from the given value.
+ */
+void ParticleEmitter::setEmissionMomentum(float momentum, float randomMomentum)
+{
+  this->momentum = momentum;
+  this->momentumRandom = randomMomentum;
+}
+
+/**
+ *  this set the time to life of a particle, after which it will die
+ * @param dt: the time to live in seconds
+ * @param system: the system into which to emitt
+
+   if you want to change the value of this variable during emission time (to make it more dynamic)
+   you may want to use the animation class
+*/
+void ParticleEmitter::tick(float dt)
+{
+  assert (this->system != NULL);
+  if (likely(dt > 0.0 && this->emissionRate > 0.0))
+  {
+    // saving the time (particles only partly emitted in this timestep)
+    float count = (dt+this->saveTime) * this->emissionRate;
+    this->saveTime = modff(count, &count) / this->emissionRate;
+    PRINTF(5)("emitting %f particles, saving %f seconds for the next timestep\n", count, this->saveTime);
+    if (count + this->system->getCount() > this->system->getMaxCount())
+      count = this->system->getMaxCount() - this->system->getCount();
+    if (likely(count > 0.0f))
+      this->emitParticles((unsigned int)count);
+  }
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleEmitter::debug() const
+{
+  PRINT(0)(" ParticleEmitter %s::%s\n", this->getClassCName(), this->getCName());
+  PRINT(0)("  EmissionRate: %f, Speed: %f, SpreadAngle: %f\n", this->getEmissionRate(), this->getEmissionVelocity(), this->getSpread());
+}
Index: /branches/new_class_id/src/world_entities/particles/particle_emitter.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/particle_emitter.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/particle_emitter.h	(revision 9758)
@@ -0,0 +1,82 @@
+/*!
+ * @file particle_emitter.h
+  *  Definition of a ParticleEmitter
+*/
+
+#ifndef _PARTICLE_EMITTER_H
+#define _PARTICLE_EMITTER_H
+
+#include "p_node.h"
+
+// FORWARD DECLARATION
+class ParticleSystem;
+class TiXmlElement;
+
+// Default values
+#define PARTICLE_EMITTER_DEFAULT_SIZE              1.0
+#define PARTICLE_EMITTER_DEFAULT_EMISSION_RATE     50
+#define PARTICLE_EMITTER_DEFAULT_INHERIT_SPEED     0.0
+#define PARTICLE_EMITTER_DEFAULT_SPREAD            M_PI
+#define PARTICLE_EMITTER_DEFAULT_VELOCITY          1.0
+
+//! A class to handle an Emitter.
+class ParticleEmitter : public PNode
+{
+  ObjectListDeclaration(ParticleEmitter);
+  friend class ParticleSystem;
+public:
+  ParticleEmitter(float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+                  float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+                  float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  virtual ~ParticleEmitter();
+
+  virtual void loadParams(const TiXmlElement* root = NULL);
+
+  /* controlling the emitter: interface */
+  void start();
+  void stop();
+  void tick(float dt);
+
+  void setSystem(ParticleSystem* system);
+  ParticleSystem* getSystem() const { return this->system; };
+
+  /* controlling the behavour: these can be used as Animation interfaces */
+  void setEmissionRate(float emissionRate);
+  void setInheritSpeed(float value);
+  void setSpread(float angle, float randomAngle = 0.0);
+  void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
+  void setEmissionMomentum(float momentum, float randomMomentum = 0.0);
+
+  /** @returns the emissionRate */
+  inline float getEmissionRate() const { return this->emissionRate; };
+  /** @returns the inherit-speed-factor */
+  inline float getInheritSpeed() const { return this->inheritSpeed; };
+  /** @returns the SpreadAngle of the emitter */
+  inline float getSpread() const { return this->angle; };
+  /** @returns the EmissionVelocity of the emitter */
+  inline float getEmissionVelocity() const { return this->velocity; };
+  /** @returns the EmissionMomentum of this emitter */
+  inline float getEmissionMomentum() const { return this->momentum; };
+
+
+  void debug() const;
+
+protected:
+  virtual void emitParticles(unsigned int count) const = 0;
+
+protected:
+  float           inheritSpeed;      //!< How much speed the particle inherits from the Emitters speed.
+  float           angle;             //!< max angle from the direction of the emitter
+  float           randomAngle;       //!< random emission angle (angle +- angleRandom is the emitted angle.
+  float           velocity;          //!< the initial speed of a Particles.
+  float           randomVelocity;    //!< the random variation from the initial Speed.
+  float           momentum;          //!< The Initial spped of the Rotation.
+  float           momentumRandom;    //!< The random variation of the Momentum.
+
+private:
+  ParticleSystem* system;            //!< The ParticleSystem this Emitter Emits into.
+  float           saveTime;          //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
+  float           emissionRate;      //!< amount of particles per seconds emitted by emitter.
+};
+
+#endif /* _PARTICLE_EMITTER_H */
Index: /branches/new_class_id/src/world_entities/particles/particle_system.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/particle_system.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/particle_system.cc	(revision 9758)
@@ -0,0 +1,483 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "particle_system.h"
+
+#include "particle_emitter.h"
+
+#include "field.h"
+#include "model.h"
+
+#include "util/loading/load_param_xml.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include <algorithm>
+
+ObjectListDefinition(ParticleSystem);
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the ParticleSystem
+*/
+ParticleSystem::ParticleSystem (unsigned int maxCount)
+{
+  this->registerObject(this, ParticleSystem::_objectList);
+
+  this->setMaxCount(PARTICLE_DEFAULT_MAX_COUNT);
+  this->count = 0;
+  this->particles = NULL;
+  this->deadList = NULL;
+  this->conserve = 1.0;
+  this->lifeSpan = 1.0; this->randomLifeSpan = 0.0;
+
+  this->toList(OM_ENVIRON);
+
+  this->maxCount = maxCount;
+}
+
+/**
+ * @brief standard deconstructor
+ */
+ParticleSystem::~ParticleSystem()
+{
+  // deleting all the living Particles
+  while (this->particles)
+  {
+    Particle* tmpDelPart = this->particles;
+    this->particles = this->particles->next;
+    delete tmpDelPart;
+  }
+
+  // deleting all the dead particles
+  while (this->deadList)
+  {
+    Particle* tmpDelPart = this->deadList;
+    this->deadList = this->deadList->next;
+    delete tmpDelPart;
+  }
+
+  while(!this->emitters.empty())
+  {
+    this->removeEmitter(this->emitters.front());
+  }
+
+}
+
+
+/**
+ * @brief loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void ParticleSystem::loadParams(const TiXmlElement* root)
+{
+  WorldEntity::loadParams(root);
+  PhysicsInterface::loadParams(root);
+
+  LoadParam(root, "max-count", this, ParticleSystem, setMaxCount)
+  .describe("the maximal count of Particles, that can be emitted into this system");
+
+  LoadParam(root, "life-span", this, ParticleSystem, setLifeSpan)
+  .describe("sets the life-span of the Particles.");
+
+  LoadParam(root, "conserve", this, ParticleSystem, setConserve)
+  .describe("sets the Conserve factor of the Particles (1.0: they keep all their energy, 0.0:they keep no energy)");
+
+  LoadParamXML(root, "emitters", this, ParticleSystem, loadEmitters);
+
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    element->ToText();
+    // PER-PARTICLE-ATTRIBUTES:
+    LoadParam_CYCLE(element, "radius", this, ParticleSystem, setRadius)
+    .describe("The Radius of each particle over time (TimeIndex [0-1], radius at TimeIndex, randomRadius at TimeIndex)");
+
+    LoadParam_CYCLE(element, "mass", this, ParticleSystem, setMass)
+    .describe("The Mass of each particle over time (TimeIndex: [0-1], mass at TimeIndex, randomMass at TimeIndex)");
+
+    LoadParam_CYCLE(element, "color", this, ParticleSystem, setColor)
+    .describe("The Color of each particle over time (TimeIndex: [0-1], red: [0-1], green: [0-1], blue: [0-1], alpha: [0-1])");
+  }
+  LOAD_PARAM_END_CYCLE(element);
+
+  LoadParam(root, "precache", this, ParticleSystem, precache)
+  .describe("Precaches the ParticleSystem for %1 seconds, %2 times per Second")
+  .defaultValues(1.0, 25.0);
+}
+
+/**
+ * @brief loads the Emitters from An XML-Root
+ * @param root the XML-Element to load all emitters from
+ */
+void ParticleSystem::loadEmitters(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    BaseObject* emitter = Factory::fabricate(element);
+    if (emitter != NULL)
+    {
+      if (emitter->isA(ParticleEmitter::staticClassID()))
+        this->addEmitter(dynamic_cast<ParticleEmitter*>(emitter));
+      else
+      {
+        PRINTF(2)("Tried to load an Element of type '%s' that should be a ParticleEmitter onto '%s::%s'.\n",
+                  emitter->getClassCName(), this->getClassCName(), this->getCName());
+        delete emitter;
+      }
+    }
+    else
+    {
+      PRINTF(2)("Could not Generate Emitter for system %s::%s (wrong type in XML-format)\n", this->getClassCName(), getCName());
+    }
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @param maxCount the maximum count of particles that can be emitted
+ */
+void ParticleSystem::setMaxCount(unsigned int maxCount)
+{
+  this->maxCount = maxCount;
+  PRINTF(4)("MAXCOUNT of %s::%s is %d\n", this->getClassCName(), this->getCName(), maxCount);
+}
+
+// setting properties
+/**
+ * @brief Sets the lifespan of newly created particles
+ * @param lifeSpan the LifeSpan of each particle in the System
+ * @param randomLifeSpan the Deviation from lifeSpan (random Value).
+*/
+void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan)
+{
+  this->lifeSpan = lifeSpan;
+  this->randomLifeSpan = randomLifeSpan;
+  PRINTF(4)("LifeTime of %s::%s is %f\n", this->getClassCName(), this->getCName(), lifeSpan);
+}
+
+/**
+ * @brief sets the conserve Factor of newly created particles
+ * @param conserve sets the conserve factor of each particle.
+ * Conserve is the ammount of energy a particle takes from the last Frame into the next.
+ * A Value of 1 means, that all energy is conserved, a Value of 0 means infinit friction.
+ */
+void ParticleSystem::setConserve(float conserve)
+{
+  if (conserve > 1.0)
+    this->conserve = 1.0;
+  else if (conserve < 0.0)
+    this->conserve = 0.0;
+  else
+    this->conserve = conserve;
+
+  PRINTF(4)("Conserve of %s::%s is %f\n", this->getClassCName(), this->getCName(), conserve);
+}
+
+/////////////////////////////
+/* Per-Particle Attributes */
+/////////////////////////////
+/**
+ * @brief sets a key in the radius-animation on a per-particle basis
+ * @param lifeCycleTime the time (partilceLifeTime/particleAge) [0-1]
+ * @param radius the radius at this position
+ * @param randRadius the randRadius at this position
+*/
+void ParticleSystem::setRadius(float lifeCycleTime, float radius, float randRadius)
+{
+  this->radiusAnim.changeValue(lifeCycleTime, radius);
+  this->randRadiusAnim.changeValue(lifeCycleTime, randRadius);
+
+  PRINTF(4)("Radius of %s::%s at timeSlice %f is %f with a Random of %f\n",
+    this->getClassCName(), this->getCName(), lifeCycleTime, radius, randRadius);
+}
+
+/**
+ * @brief sets a key in the mass-animation on a per-particle basis
+ * @param lifeCycleTime the time (partilceLifeTime/particleAge) [0-1]
+ * @param mass the mass at this position
+ * @param randMass the randomMass at this position
+*/
+void ParticleSystem::setMass(float lifeCycleTime, float mass, float randMass)
+{
+  this->massAnim.changeValue(lifeCycleTime, mass);
+  this->randMassAnim.changeValue(lifeCycleTime, randMass);
+}
+
+/**
+ * @brief sets a key in the color-animation on a per-particle basis
+ * @param lifeCycleTime: the time (partilceLifeTime/particleAge) [0-1]
+ * @param red: red
+ * @param green: green
+ * @param blue: blue
+ * @param alpha: alpha
+*/
+void ParticleSystem::setColor(float lifeCycleTime, float red, float green, float blue, float alpha)
+{
+  this->colorAnim[0].changeValue(lifeCycleTime, red);
+  this->colorAnim[1].changeValue(lifeCycleTime, green);
+  this->colorAnim[2].changeValue(lifeCycleTime, blue);
+  this->colorAnim[3].changeValue(lifeCycleTime, alpha);
+
+  PRINTF(4)("Color of %s::%s on timeslice %f is r:%f g:%f b:%f a:%f\n",
+    this->getClassCName(), this->getCName(), lifeCycleTime, red, green, blue, alpha);
+}
+
+/**
+ * @brief sets a key in the color-animation on a per-particle basis
+ * @param lifeCycleTime: the time (partilceLifeTime/particleAge) [0-1]
+ * @param color the Color.
+ */
+void ParticleSystem::setColor(float lifeCycleTime, const Color& color)
+{
+  this->setColor(lifeCycleTime, color.r(), color.g(), color.b(), color.a());
+}
+
+
+/**
+ * @brief adds an Emitter to this System.
+ * @param emitter the Emitter to add.
+ */
+void ParticleSystem::addEmitter(ParticleEmitter* emitter)
+{
+  assert (emitter != NULL);
+  if (emitter->getSystem() != NULL)
+    emitter->getSystem()->removeEmitter(emitter);
+  emitter->system = this;
+  this->emitters.push_back(emitter);
+}
+
+/**
+ * @brief removes a ParticleEmitter from this System
+ * @param emitter the Emitter to remove
+ */
+void ParticleSystem::removeEmitter(ParticleEmitter* emitter)
+{
+  assert (emitter != NULL);
+  emitter->system = NULL;
+  this->emitters.remove(emitter);
+  /*  std::list<ParticleEmitter*>::iterator it = std::find(this->emitters.begin(), this->emitters.end(), emitter);
+  if (it != this->emitters.end())
+    this->emitters.erase(it);*/
+}
+
+/**
+ * @brief does a Precaching, meaning, that the ParticleSystem(and its emitters) will be ticked force
+ * @param seconds: seconds
+ * @param ticksPerSeconds times per Second.
+ */
+void ParticleSystem::precache(unsigned int seconds, unsigned int ticksPerSecond)
+{
+  std::list<ParticleEmitter*>::iterator emitter;
+  for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++)
+    (*emitter)->updateNode(.1), (*emitter)->updateNode(.1);
+
+  PRINTF(4)("Precaching %s::%s %d seconds %d timesPerSecond\n", this->getClassCName(), this->getCName(), seconds, ticksPerSecond);
+  for (unsigned int i = 0; i < seconds*ticksPerSecond; i++)
+    this->tick(1.0/(float)ticksPerSecond);
+}
+
+
+/**
+ * @brief ticks the system.
+ * @param dt the time to tick all the Particles of the System
+
+   this is used to get all the particles some motion
+*/
+void ParticleSystem::tick(float dt)
+{
+  Particle* tickPart = particles;  // the particle to Tick
+  Particle* prevPart = NULL;
+  while (likely(tickPart != NULL))
+  {
+    // applying force to the System.
+    if (likely (tickPart->mass > 0.0))
+      tickPart->velocity += tickPart->extForce / tickPart->mass * dt;
+
+    tickPart->radius = radiusAnim.getValue(tickPart->lifeCycle)
+                       + randRadiusAnim.getValue(tickPart->lifeCycle) * tickPart->radiusRand;
+
+    tickPart->mass = massAnim.getValue(tickPart->lifeCycle)
+                     + randMassAnim.getValue(tickPart->lifeCycle) * tickPart->massRand;
+
+    tickPart->extForce = Vector(0,0,0);
+
+    // applying Color
+    this->colorAnim[0].getValue(tickPart->color[0], tickPart->lifeCycle);
+    this->colorAnim[1].getValue(tickPart->color[1], tickPart->lifeCycle);
+    this->colorAnim[2].getValue(tickPart->color[2], tickPart->lifeCycle);
+    this->colorAnim[3].getValue(tickPart->color[3], tickPart->lifeCycle);
+
+    // rendering new position.
+    tickPart->position += tickPart->velocity * dt;
+    tickPart->orientation *= tickPart->momentum *dt;
+
+    // many more to come
+
+    if (this->conserve < 1.0)
+    {
+      tickPart->velocity *= this->conserve;
+      tickPart->momentum *= this->conserve;
+    }
+    // find out if we have to delete tickPart
+    if (unlikely((tickPart->lifeCycle += dt/tickPart->lifeTime) >= 1.0))
+    {
+      // remove the particle from the list
+      if (likely(prevPart != NULL))
+      {
+        prevPart->next = tickPart->next;
+        tickPart->next = this->deadList;
+        this->deadList = tickPart;
+        tickPart = prevPart->next;
+      }
+      else
+      {
+        prevPart = NULL;
+        this->particles = tickPart->next;
+        tickPart->next = this->deadList;
+        this->deadList = tickPart;
+        tickPart = this->particles;
+      }
+      --this->count;
+    }
+    else
+    {
+      prevPart = tickPart;
+      tickPart = tickPart->next;
+    }
+  }
+
+  std::list<ParticleEmitter*>::iterator emitter;
+  for (emitter = this->emitters.begin(); emitter != this->emitters.end(); emitter++)
+    (*emitter)->tick(dt);
+}
+
+/**
+  *  applies some force to a Particle.
+  * @param field the Field to apply.
+ */
+void ParticleSystem::applyField(const Field* field)
+{
+  Particle* tickPart = particles;
+  while (tickPart)
+  {
+    tickPart->extForce += field->calcForce(tickPart->position);
+    tickPart = tickPart->next;
+  }
+}
+
+
+/**
+ * @returns the count of Faces of this ParticleSystem
+ */
+unsigned int ParticleSystem::getFaceCount() const
+{
+  return this->count;
+}
+
+/**
+ * @brief adds a new Particle to the System
+ * @param position the initial position, where the particle gets emitted.
+ * @param velocity the initial velocity of the particle.
+ * @param orientation the initial orientation of the Paritcle.
+ * @param momentum the initial momentum of the Particle (the speed of its rotation).
+ * @param data some more data given by the emitter
+*/
+void ParticleSystem::addParticle(const Vector& position, const Vector& velocity, const Quaternion& orientation, const Quaternion& momentum, unsigned int data)
+{
+  if (this->count <= this->maxCount)
+  {
+    // if it is the first Particle
+    if (unlikely(particles == NULL))
+    {
+      if (likely(deadList != NULL))
+      {
+        this->particles = this->deadList;
+        deadList = deadList->next;
+      }
+      else
+      {
+        PRINTF(5)("Generating new Particle\n");
+        this->particles = new Particle;
+      }
+      this->particles->next = NULL;
+    }
+    // filling the List from the beginning
+    else
+    {
+      Particle* tmpPart;
+      if (likely(deadList != NULL))
+      {
+        tmpPart = this->deadList;
+        deadList = deadList->next;
+      }
+      else
+      {
+        PRINTF(5)("Generating new Particle\n");
+        tmpPart = new Particle;
+      }
+      tmpPart->next = this->particles;
+      this->particles = tmpPart;
+    }
+    particles->lifeTime = this->lifeSpan + (float)(rand()/RAND_MAX)* this->randomLifeSpan;
+    particles->lifeCycle = 0.0;
+    particles->position = position;
+    particles->velocity = velocity;
+
+    particles->orientation = orientation;
+    particles->momentum = momentum;
+
+    //  particle->rotation = ; //! @todo rotation is once again something to be done.
+    particles->massRand = 2*(float)rand()/RAND_MAX -1;
+    particles->radiusRand = 2* (float)rand()/RAND_MAX -1;
+    particles->mass = this->massAnim.getValue(0.0) + this->randMassAnim.getValue(0.0)*particles->massRand;
+    particles->radius = this->radiusAnim.getValue(0.0) + this->randRadiusAnim.getValue(0.0)*particles->radiusRand;
+
+    ++this->count;
+  }
+  else
+    PRINTF(4)("maximum count of particles reached not adding any more\n");
+}
+
+/**
+ *  outputs some nice debug information
+*/
+void ParticleSystem::debug() const
+{
+  PRINT(0)("  ParticleCount: %d emitters: %d, maximumCount: %d :: filled %d%%\n",
+           this->count,
+           this->emitters.size(),
+           this->maxCount,
+           ((this->maxCount!=0)?100*this->count/this->maxCount:0));
+
+
+  PRINT(0)("  Coloring sceme: r:"), this->colorAnim[0].debug();
+  PRINT(0)("  Coloring sceme: g:"), this->colorAnim[1].debug();
+  PRINT(0)("  Coloring sceme: b:"), this->colorAnim[2].debug();
+  PRINT(0)("  Coloring sceme: a:"), this->colorAnim[3].debug();
+
+  if (likely(this->deadList != NULL))
+  {
+    PRINT(0)("  - ParticleDeadList is used: ");
+    int i = 1;
+    Particle* tmpPart = this->deadList;
+    while ((tmpPart = tmpPart->next) != NULL) { ++i; }
+    PRINT(0)("count: %d\n", i);
+  }
+}
Index: /branches/new_class_id/src/world_entities/particles/particle_system.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/particle_system.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/particle_system.h	(revision 9758)
@@ -0,0 +1,133 @@
+/*!
+ * @file particle_system.h
+
+*/
+
+#ifndef _PARTICLE_SYSTEM_H
+#define _PARTICLE_SYSTEM_H
+
+#include "world_entity.h"
+#include "physics_interface.h"
+
+#include "glincl.h"
+#include "vector.h"
+#include <list>
+#include "color.h"
+
+#include "quick_animation.h"
+
+// Forward Declaration
+class TiXmlElement;
+
+#define PARTICLE_DOT_MASK              0x000001     //!< A Mask if the Particles should be displayed as DOTs
+#define PARTICLE_SPARK_MASK            0x000010     //!< A Mask if the Particles should be displayed as SPARKs
+#define PARTICLE_SPRITE_MASK           0x000100     //!< A Mask if the Particles should be displayed as SPRITESs
+#define PARTICLE_MODEL_MASK            0x001000     //!< A Mask if the Particles should be displayed as MODELSs
+#define PARTICLE_WORDL_ENTITY_MASK     0x010000     //!< A Mask if the Particles should be displayed as WORLD_ENTITIEs
+#define PARTICLE_MULTI_MASK            0x100000     //!< A Mask if they are Multi-partilces
+
+#define PARTICLE_DEFAULT_MAX_COUNT    200               //!< A default count of particles in the system.
+
+// FORWARD DECLARATION
+class Material;
+class ParticleEmitter;
+class Field;
+
+//! A struct for one Particle
+typedef struct Particle
+{
+  float         lifeTime;            //!< The time this particle has to live.
+  float         lifeCycle;           //!< The fraction of time passed. (in percentage of its lifeTime)
+
+  Vector        position;            //!< The current position of this particle.
+  Vector        velocity;            //!< The current velocity of this Particle.
+  Vector        extForce;            //!< The external Force that influences this Particle.
+  Quaternion    orientation;         //!< The current orientation of this Particle.
+  Quaternion    momentum;            //!< The current angular momentum (spin) of this Particle.
+  float         mass;                //!< The mass of this Particle.
+  float         massRand;            //!< A random mass
+  float         radius;              //!< The current size of this Particle.
+  float         radiusRand;          //!< a random Radius
+  GLfloat       color [4];           //!< A Color for the particles.
+
+  Particle*     next;                //!< pointer to the next particle in the List. (NULL if no preceding one)
+};
+
+//! A class to handle ParticleSystems
+class ParticleSystem : public WorldEntity, public PhysicsInterface {
+  ObjectListDeclaration(ParticleSystem);
+
+ public:
+  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  virtual ~ParticleSystem();
+
+  virtual void loadParams(const TiXmlElement* root);
+  void loadEmitters(const TiXmlElement* root);
+
+  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
+  void setConserve(float conserve);
+  void setMaxCount(unsigned int maxCount);
+
+  /* Per-Particle-Attributes */
+  void setRadius(float lifeCycleTime, float radius, float randRadius = 0.0);
+  void setMass(float lifeCycleTime, float mass, float randMass = 0.0);
+  void setColor(float lifeCycleTime, float red, float green, float blue, float alpha);
+  void setColor(float lifeCycleTime, const Color& color);
+
+  /** @returns the lifespan of the particles */
+  inline float getLifeSpan() const { return this->lifeSpan; };
+  /** @returns the starting-radius of the particles */
+  inline float getStartRadius() { return this->radiusAnim.getValue(0.0); };
+  /** @returns the end-radius of the particles */
+  inline float getEndRadius() { return this->radiusAnim.getValue(1.0); };
+  /** @returns the conserve-factor of the particles */
+  inline float getConserve() const { return this->conserve; };
+  /** @returns the initial mass of the particles */
+  inline float getMass() const { return this->initialMass; };
+
+  /** @returns the count of particles in this System */
+  inline unsigned int getCount() const { return this->count; };
+  /** @returns the maximum count of particles that can be contained by this System */
+  inline unsigned int getMaxCount() const { return this->maxCount; };
+
+  virtual unsigned int getFaceCount() const;
+
+  void addEmitter(ParticleEmitter* emitter);
+  void removeEmitter(ParticleEmitter* emitter);
+
+  virtual void applyField(const Field* field);
+  /** @brief this is an empty function, because the Physics are implemented in tick @param dt: useless here */
+  virtual void tickPhys(float dt) {};
+
+  void addParticle(const Vector& position, const Vector& velocity, const Quaternion& orientation, const Quaternion& momentum, unsigned int data = 0);
+
+  void precache(unsigned int seconds, unsigned int ticksPerSecond = 25);
+
+  virtual void tick(float dt);
+  virtual void draw() const = 0;
+
+  void debug() const;
+
+ protected:
+  float             conserve;            //!< How much energy gets conserved to the next Tick.
+  float             lifeSpan;            //!< Initial lifetime of a Particle.
+  float             randomLifeSpan;      //!< A random value for the Lifespan (around the initial lifetime)
+  float             initialMass;         //!< The initial Mass of the Particle
+  float             randomInitialMass;   //!< The random initial Mass of the Particle
+
+  unsigned int      maxCount;            //!< The maximum count of Particles.
+  unsigned int      count;               //!< The current count of Particles.
+  Particle*         particles;           //!< A list of particles of this System.
+  Particle*         deadList;            //!< A list of dead Particles in the System.
+
+  std::list<ParticleEmitter*> emitters;  //!< The Emitters that do emit into this System.
+
+  // per particle attributes
+  QuickAnimation    radiusAnim;          //!< Animation of the radius
+  QuickAnimation    randRadiusAnim;      //!< Animation of the random Value of the radius
+  QuickAnimation    massAnim;            //!< Animation of the mass
+  QuickAnimation    randMassAnim;        //!< Animation of the random Mass
+  QuickAnimation    colorAnim[4];        //!< Animation of the 4 colors (r,g,b,a)
+};
+
+#endif /* _PARTICLE_SYSTEM_H */
Index: /branches/new_class_id/src/world_entities/particles/plane_emitter.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/plane_emitter.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/plane_emitter.cc	(revision 9758)
@@ -0,0 +1,116 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "plane_emitter.h"
+
+#include "particle_system.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(PlaneEmitter, CL_PLANE_EMITTER);
+CREATE_FACTORY(PlaneEmitter);
+
+/**
+ *  standard constructor
+*/
+PlaneEmitter::PlaneEmitter(const Vector2D& size, float emissionRate, float velocity, float angle)
+    :  ParticleEmitter(emissionRate, velocity, angle)
+{
+  this->init();
+  this->setSize(size);
+}
+
+/**
+ *  constructs and loads a PlaneEmitter from a XML-element
+ * @param root the XML-element to load from
+*/
+PlaneEmitter::PlaneEmitter(const TiXmlElement* root)
+    : ParticleEmitter()
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard destructor
+
+   removes the EmitterSystem from the ParticleEngine
+*/
+PlaneEmitter::~PlaneEmitter ()
+{
+  this->setSystem(NULL);
+}
+
+/**
+  @brief initializes default values of a ParitcleEmitter
+*/
+void PlaneEmitter::init()
+{
+  this->registerObject(this, PlaneEmitter::_objectList);
+  this->setSize(1.0f, 1.0f);
+}
+
+void PlaneEmitter::loadParams(const TiXmlElement* root)
+{
+  ParticleEmitter::loadParams(root);
+
+  LoadParam(root, "size", this, PlaneEmitter, setSize)
+  .describe("The Size of the PlaneEmitter: x, y")
+  .defaultValues(1.0f,1.0f);
+}
+
+void PlaneEmitter::setSize(float x, float y)
+{
+  this->size = Vector2D(x, y);
+}
+
+
+void PlaneEmitter::emitParticles(unsigned int count) const
+{
+  Vector inheritVelocity = this->getVelocity() * this->inheritSpeed;
+
+  Vector xDir = this->getAbsDirX() * this->size.x;
+  Vector yDir = this->getAbsDirZ() * this->size.y;
+  Vector zDir = this->getAbsDirY();
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    randDir = (Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(zDir);
+    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+    Vector plane = this->getAbsCoor() +
+        xDir * ((float)rand()/RAND_MAX -.5) +
+        yDir * ((float)rand()/RAND_MAX -.5);
+
+    // ROTATIONAL CALCULATION (this must not be done for all types of particles.)
+    randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+    randDir.normalize();
+    Quaternion orient = Quaternion(M_PI, randDir);
+    Quaternion moment = Quaternion(this->momentum + this->momentumRandom, randDir);
+
+    this->getSystem()->addParticle(plane, velocityV, orient, moment);
+
+  }
+}
Index: /branches/new_class_id/src/world_entities/particles/plane_emitter.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/plane_emitter.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/plane_emitter.h	(revision 9758)
@@ -0,0 +1,49 @@
+/*!
+ * @file plane_emitter.h
+ * Definition of a PlaneEmitter
+ */
+
+#ifndef _PLANE_EMITTER_H
+#define _PLANE_EMITTER_H
+
+#include "particle_emitter.h"
+
+#include "vector2D.h"
+
+#define PLANE_EMITTER_DEFAULT_SIZE Vector2D(1.0f, 1.0f)
+
+//! A class to handle a Plane Emitter.
+/**
+ * A Plane Emitter is a special kind of emitter, that has the (underlying) PNode
+ * at its center, and from there on is a Plane in the Direction of the PNode
+ * out around size in the corresponding directions in x and z
+ */
+class PlaneEmitter : public ParticleEmitter
+{
+  ObjectListDeclaration(PlaneEmitter);
+
+  friend class ParticleSystem;
+public:
+  PlaneEmitter(const Vector2D& size = PLANE_EMITTER_DEFAULT_SIZE,
+               float emissionRate = PARTICLE_EMITTER_DEFAULT_EMISSION_RATE,
+               float velocity = PARTICLE_EMITTER_DEFAULT_VELOCITY,
+               float angle = PARTICLE_EMITTER_DEFAULT_SPREAD);
+  PlaneEmitter(const TiXmlElement* root);
+  virtual ~PlaneEmitter();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setSize(float x, float y);
+  void setSize(const Vector2D& size) { this->setSize(size.x, size.y); };
+
+protected:
+  virtual void emitParticles(unsigned int count) const;
+
+private:
+  void init();
+
+private:
+  Vector2D      size;
+};
+
+#endif /* _PLANE_EMITTER_H */
Index: /branches/new_class_id/src/world_entities/particles/quick_animation.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/quick_animation.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/quick_animation.cc	(revision 9758)
@@ -0,0 +1,316 @@
+/*
+   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 <algorithm>
+
+
+
+/**
+ * @brief standard constructor
+ * @param resolution the Resolution of the LookupTable
+ */
+QuickAnimation::QuickAnimation (unsigned int resolution)
+{
+  this->lookupValues.resize(resolution, 0.0f);
+}
+
+/**
+ * @brief deletes all the deconstructor stuff
+ */
+QuickAnimation::~QuickAnimation ()
+{ }
+
+/**
+ * @brief adds a new entry to the list of keyframes
+ * @param position the position to add the key to
+ * @param value the Value to set for the position
+ * @returns false if the key existed already for a given position
+ */
+bool QuickAnimation::addKey(float position, float value)
+{
+  if (position > 1.0f || position < 0.0f)
+  {
+    printf("QuickAnimation::Position MUST BE between 0.0f and 1.0f\n");
+    return false;
+  }
+  if(std::find(this->keyFrames.begin(), this->keyFrames.end(), position) != this->keyFrames.end())
+  {
+    printf("QuickAnimation:: key at position %f already added. Use changeValue instead\n", position);
+    return false;
+  }
+  this->keyFrames.push_back(QuickKeyFrame(position, value));
+
+  this->rebuild();
+  return true;
+}
+
+
+/**
+ * @brief changes an entry in the region of position
+ * @param position the Position of an existing keyframe
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @param value the new Value
+ */
+bool QuickAnimation::changeValueKey(unsigned int keyFrameNumber, float newValue)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].value = newValue;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief changes an entry in the region of position
+ * @param position the Position of an existing keyframe
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @param value the new Value
+ *
+ * This Function adds a new KeyFrame at position with newValue, if none was found in region of position.
+ */
+bool QuickAnimation::changeValue(float position, float newValue, float region)
+{
+  int keyFrame = this->getKeyAt(position, region);
+  if (keyFrame == -1)
+    return this->addKey(position, newValue);
+  else
+    return this->changeValueKey(keyFrame, newValue);
+}
+
+
+/**
+ * @brief removes the keyFrameNumber'th entry.
+ * @param keyFrameNumber the n'th Keyframe to remove.
+ * @returns true on success, false if keyFrameNumber did not exist.
+ */
+bool QuickAnimation::removeKey(unsigned int keyFrameNumber)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames.erase(this->keyFrames.begin() + keyFrameNumber);
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+
+/**
+ * @brief removes a KeyFrame from the List.
+ * @param position the Keyframe at position position will be erased.
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @returns true on success, false if no KeyFrame was found.
+ */
+bool QuickAnimation::remove(float position, float region)
+{
+  int keyFrame = this->getKeyAt(position, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->removeKey(keyFrame);
+}
+
+/**
+ * @brief moves the keyFrame keyFrameNumber to newPosition/newValue.
+ * @param keyFrameNumber the n'th KeyFrame to move.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param newValue the new Value for the KeyFrame.
+ * @returns true on success, false if the KeyFrame did not exist.
+ */
+bool QuickAnimation::moveKey(unsigned int keyFrameNumber, float newPosition, float newValue)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].position = newPosition;
+    this->keyFrames[keyFrameNumber].value = newValue;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief moves the keyFrame keyFrameNumber to newPosition/value.
+ * @param keyFrameNumber the n'th KeyFrame to move.
+ * @param newPosition the new Position for the KeyFrame.
+ * @returns true on success, false if the KeyFrame did not exist.
+ */
+bool QuickAnimation::moveKey(unsigned int keyFrameNumber, float newPosition)
+{
+  if (keyFrameNumber < this->keyFrames.size())
+  {
+    this->keyFrames[keyFrameNumber].position = newPosition;
+    this->rebuild();
+    return true;
+  }
+  else
+    return false;
+}
+
+/**
+ * @brief moves the keyFrame in the region of oldPosition to newPosition/newValue.
+ * @param oldPosition the old Position for the KeyFrame.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param newValue the new Value for the KeyFrame.
+ * @param region the region around oldPosition to search for the KeyFrame.
+ * @returns true on success, false if the KeyFrame was not found within the region of oldPosition.
+ */
+bool QuickAnimation::move(float oldPosition, float newPosition, float newValue, float region)
+{
+  int keyFrame = this->getKeyAt(oldPosition, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->moveKey(keyFrame, newPosition, newValue);
+}
+
+/**
+ * @brief moves the keyFrame in the region of oldPosition to newPosition/Value.
+ * @param oldPosition the old Position for the KeyFrame.
+ * @param newPosition the new Position for the KeyFrame.
+ * @param region the region around oldPosition to search for the KeyFrame.
+ * @returns true on success, false if the KeyFrame was not found within the region of oldPosition.
+ */
+bool QuickAnimation::move(float oldPosition, float newPosition, float region)
+{
+  int keyFrame = this->getKeyAt(oldPosition, region);
+  if (keyFrame == -1)
+    return false;
+  else
+    return this->moveKey(keyFrame, newPosition);
+}
+
+
+/**
+ * @brief searches for a Keyframe in the region of position
+ * @param position the Keyframe at position position will searched for.
+ * @param region a deviation of the existing keyframe (like a delta in witch to search for)
+ * @returns the keyFrame on success, -1 on fault.
+ */
+int QuickAnimation::getKeyAt(float position, float region)
+{
+  for (unsigned int i = 0; i < this->keyFrames.size(); i++)
+  {
+    if (this->keyFrames[i].position + region/2.0 > position && this->keyFrames[i].position - region/2.0 < position)
+      return i;
+  }
+  return -1;
+}
+
+
+/**
+ * @brief rebuilds the QuickAnimation.
+ */
+void QuickAnimation::rebuild()
+{
+  // if we do not have any KeyFrames
+  if (this->keyFrames.empty())
+  {
+    for (unsigned int i = 0; i < this->lookupValues.size(); i++)
+      this->lookupValues[i] = 0.0f;
+    return;
+  }
+
+  // Sort the List.
+  std::sort(this->keyFrames.begin(), this->keyFrames.end(), QuickKeyFrame::sortPositionPredicate);
+
+  // rebuild the lookup-table
+  float sliceSize = 1.0f / this->lookupValues.size();
+  unsigned int key = 0;
+  float preVal = this->keyFrames[0].value;
+  float prePos = this->keyFrames[0].position;
+
+  float postVal = preVal;
+  float postPos = 1.0;
+
+  if (this->keyFrames.size() > 1)
+  {
+    postVal = this->keyFrames[1].value;
+    postPos = this->keyFrames[1].position;
+  }
+
+
+  for (unsigned int i = 0; i < this->lookupValues.size(); i++)
+  {
+    float position = (float)i * sliceSize;
+
+    // if we reach the Next KeyFrame
+    if (position > postPos)
+    {
+      // if we have more KeyFrames.
+      if (this->keyFrames.size() > ++key + 1)
+      {
+        preVal = this->keyFrames[key].value;
+        prePos = this->keyFrames[key].position;
+        postVal = this->keyFrames[key+1].value;
+        postPos = this->keyFrames[key+1].position;
+      }
+      // otherwise we reached the last KeyFrame
+      else
+      {
+        preVal = postVal;
+        prePos = postPos;
+        postPos = 1.0;
+      }
+    }
+    this->lookupValues[i] = preVal + ( postVal - preVal) / (postPos - prePos) * (position - prePos);
+  }
+}
+
+/**
+ * @brief outputs some nice information about this class
+ */
+void QuickAnimation::debug() const
+{
+  printf("QuickAnim(KeyFrames:%d, Resolution:%d)::(position, value) ", this->keyFrames.size(), this->lookupValues.size());
+
+  for (unsigned int i = 0; i < this->keyFrames.size(); i++)
+    printf("(%0.2f, %0.2f)->", this->keyFrames[i].position, this->keyFrames[i].value);
+  printf("\n");
+}
+
+
+
+/**
+ * @brief compares two QuickKeyFrames with their positions.
+ * @param key1 the first keyframe
+ * @param key2 the second keyframe
+ * @returns true, if the key1.position < key2.position.
+ */
+bool QuickAnimation::QuickKeyFrame::sortPositionPredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2)
+{
+  return (key1.position < key2.position);
+}
+
+/**
+ * @brief compares two QuickKeyFrames with their values.
+ * @param key1 the first keyframe
+ * @param key2 the second keyframe
+ * @returns true, if the key1.value < key2.value.
+ */
+bool QuickAnimation::QuickKeyFrame::sortValuePredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2)
+{
+  return (key1.value < key2.value);
+}
+
Index: /branches/new_class_id/src/world_entities/particles/quick_animation.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/quick_animation.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/quick_animation.h	(revision 9758)
@@ -0,0 +1,83 @@
+/*!
+ * @file quick_animation.h
+ * Definition of the QuickAnimation-class
+*/
+
+#ifndef _QUICK_ANIMATION_H
+#define _QUICK_ANIMATION_H
+
+#include <vector>
+// FORWARD DECLARATION
+
+//! A class for that linearely interpolates between multiple values.
+/**
+ * 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();
+
+  bool addKey(float position, float value);
+
+  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 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 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
+  {
+    //! Creates a new QuickKeyFrame with @param position position @param value value */
+    QuickKeyFrame(float position, float value) :  position(position), value(value) {};
+    //! compares this->position with position @param position pos to compare, @returns true on match.
+    bool operator==(float position) { return this->position == position; };
+    float            position;          //!< The position of thies KeyFrame
+    float            value;             //!< The value of this KeyFrame
+
+    static bool sortPositionPredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
+    static bool sortValuePredicate(const QuickKeyFrame& key1, const QuickKeyFrame& key2);
+  };
+
+  std::vector<QuickKeyFrame>    keyFrames;              //!< An Array of KeyFrames.
+  std::vector<float>            lookupValues;           //!< The lookup-table where the values are stored.
+};
+
+#endif /* _QUICK_ANIMATION_H */
Index: /branches/new_class_id/src/world_entities/particles/spark_particles.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/spark_particles.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/spark_particles.cc	(revision 9758)
@@ -0,0 +1,116 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "spark_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SparkParticles, CL_SPARK_PARTICLES);
+CREATE_FACTORY(SparkParticles);
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the SparkParticles
+*/
+SparkParticles::SparkParticles (unsigned int maxCount)
+    : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+SparkParticles::SparkParticles(const TiXmlElement* root)
+{
+  this->init();
+
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+SparkParticles::~SparkParticles()
+{ }
+
+/**
+ * @brief initializes the SparkParticles with default values
+*/
+void SparkParticles::init()
+{
+  this->registerObject(this, SparkParticles::_objectList);
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void SparkParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void SparkParticles::draw() const
+{
+
+  Particle* drawPart = particles;
+
+  glDepthMask(GL_FALSE);
+  glPushAttrib(GL_ENABLE_BIT);
+
+  glDisable(GL_LIGHTING);
+  glDisable(GL_TEXTURE_2D);
+
+  glEnable(GL_LINE_SMOOTH);
+  glEnable(GL_BLEND);
+  glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  glLineWidth(2.0);
+  glBegin(GL_LINES);
+  while (likely(drawPart != NULL))
+  {
+  //    printf("%f %f %f %f\n", drawPart->color[0], drawPart->color[1], drawPart->color[2], drawPart->color[3]);
+    glColor4fv(drawPart->color);
+    glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+    glVertex3f(drawPart->position.x - drawPart->velocity.x * drawPart->radius,
+               drawPart->position.y - drawPart->velocity.y * drawPart->radius,
+               drawPart->position.z - drawPart->velocity.z * drawPart->radius);
+    drawPart = drawPart->next;
+  }
+  glEnd();
+
+  glDepthMask(GL_TRUE);
+  glPopAttrib();
+}
Index: /branches/new_class_id/src/world_entities/particles/spark_particles.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/spark_particles.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/spark_particles.h	(revision 9758)
@@ -0,0 +1,33 @@
+/*!
+ * @file spark_particles.h
+
+*/
+
+#ifndef _SPARK_PARTICLE_SYSTEM_H
+#define _SPARK_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class SparkParticles : public ParticleSystem
+{
+  ObjectListDeclaration(SparkParticles);
+
+public:
+  SparkParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  SparkParticles(const TiXmlElement* root);
+  virtual ~SparkParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _SPARK_PARTICLE_SYSTEM_H */
Index: /branches/new_class_id/src/world_entities/particles/sprite_particles.cc
===================================================================
--- /branches/new_class_id/src/world_entities/particles/sprite_particles.cc	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/sprite_particles.cc	(revision 9758)
@@ -0,0 +1,173 @@
+/*
+   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: Benjamin Grauer
+   co-programmer: ...
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "sprite_particles.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "material.h"
+#include "state.h"
+#include "shell_command.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SpriteParticles, CL_SPRITE_PARTICLES);
+CREATE_FACTORY(SpriteParticles);
+
+SHELL_COMMAND(texture, SpriteParticles, setMaterialTexture)
+    ->defaultValues("maps/evil-flower.png");
+
+
+
+/**
+ *  standard constructor
+ * @param maxCount the Count of particles in the System
+ * @param type The Type of the SpriteParticles
+*/
+SpriteParticles::SpriteParticles (unsigned int maxCount)
+  : ParticleSystem(maxCount)
+{
+  this->init();
+}
+
+/**
+ * @brief creates a Particle System out of a XML-element
+ * @param root: the XML-element to load from
+ */
+SpriteParticles::SpriteParticles(const TiXmlElement* root)
+{
+  this->init();
+  if (root != NULL)
+    this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+SpriteParticles::~SpriteParticles()
+{ }
+
+/**
+ * @brief initializes the SpriteParticles with default values
+*/
+void SpriteParticles::init()
+{
+  this->registerObject(this, SpriteParticles::_objectList);
+
+  this->material.setDiffuseMap("maps/radial-trans-noise.png");
+}
+
+
+/**
+ * loads Parameters from a TiXmlElement
+ * @param root the XML-element to load from.
+ */
+void SpriteParticles::loadParams(const TiXmlElement* root)
+{
+  ParticleSystem::loadParams(root);
+
+  LoadParam(root, "texture", this, SpriteParticles, setMaterialTexture);
+}
+
+/**
+ * @brief sets the Texutre that is placed onto the particles
+ * @param textureFile the Texture to load onto these SpriteParticles
+ */
+void SpriteParticles::setMaterialTexture(const std::string& textureFile)
+{
+  this->material.setDiffuseMap(textureFile);
+}
+
+/**
+ * @brief draws all the Particles of this System
+ *
+ * The Cases in this Function all do the same:
+ * Drawing all the particles with the appropriate Type.
+ * This is just the fastest Way to do this, but will most likely be changed in the future.
+ */
+void SpriteParticles::draw() const
+{
+
+  Particle* drawPart = particles;
+  this->material.select();
+
+  GLboolean checkLight = false;
+  glGetBooleanv(GL_LIGHTING, &checkLight);
+  glPushAttrib(GL_LIGHTING_BIT);
+  if (checkLight == GL_TRUE)
+    glDisable(GL_LIGHTING);
+
+  glDepthMask(GL_FALSE);
+  /*
+  glClearDepth(1.0);
+  glDepthFunc(GL_LEQUAL);
+  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  glEnable(GL_BLEND);
+  glAlphaFunc(GL_GREATER,0.1);
+  glEnable(GL_ALPHA_TEST);
+  glEnable(GL_TEXTURE_2D);
+  glEnable(GL_CULL_FACE);
+  */
+  //glDepthMask(GL_FALSE);
+//glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+
+
+  while (likely(drawPart != NULL))
+  {
+    glColor4fv(drawPart->color);
+    //! @todo implement a faster code for the look-at Camera algorithm.
+
+    const PNode* camera = State::getCameraNode();  //!< @todo MUST be different
+    Vector cameraPos = camera->getAbsCoor();
+    Vector cameraTargetPos = State::getCameraTargetNode()->getAbsCoor();
+    Vector view = cameraTargetPos - cameraPos;
+    Vector up = Vector(0, 1, 0);
+    up = camera->getAbsDir().apply(up);
+    Vector h = up.cross(view);
+    Vector v = h.cross(view);
+    h.normalize();
+    v.normalize();
+    v *= .5 * drawPart->radius;
+    h *= .5 * drawPart->radius;
+
+    glBegin(GL_TRIANGLE_STRIP);
+    glTexCoord2i(1, 1);
+    glVertex3f(drawPart->position.x - h.x - v.x,
+               drawPart->position.y - h.y - v.y,
+               drawPart->position.z - h.z - v.z);
+    glTexCoord2i(0, 1);
+    glVertex3f(drawPart->position.x - h.x + v.x,
+               drawPart->position.y - h.y + v.y,
+               drawPart->position.z - h.z + v.z);
+    glTexCoord2i(1, 0);
+    glVertex3f(drawPart->position.x + h.x - v.x,
+               drawPart->position.y + h.y - v.y,
+               drawPart->position.z + h.z - v.z);
+    glTexCoord2i(0, 0);
+    glVertex3f(drawPart->position.x + h.x + v.x,
+               drawPart->position.y + h.y + v.y,
+               drawPart->position.z + h.z + v.z);
+
+    glEnd();
+
+    drawPart = drawPart->next;
+  }
+  glDepthMask(GL_TRUE);
+  glPopAttrib();
+}
Index: /branches/new_class_id/src/world_entities/particles/sprite_particles.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/sprite_particles.h	(revision 9758)
+++ /branches/new_class_id/src/world_entities/particles/sprite_particles.h	(revision 9758)
@@ -0,0 +1,38 @@
+/*!
+ * @file sprite_particles.h
+
+*/
+
+#ifndef _SPRITE_PARTICLE_SYSTEM_H
+#define _SPRITE_PARTICLE_SYSTEM_H
+
+#include "particle_system.h"
+#include "material.h"
+
+//! A class to handle ParticleSystems
+class SpriteParticles : public ParticleSystem
+{
+  ObjectListDeclaration(SpriteParticles);
+
+public:
+  SpriteParticles(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT);
+  SpriteParticles(const TiXmlElement* root);
+  virtual ~SpriteParticles();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  void setMaterialTexture(const std::string& textureFile);
+
+  /** @returns the Material that lies on this particles */
+  inline const Material* getMaterial() const { return &this->material; };
+
+  virtual void draw() const;
+
+private:
+  void init();
+
+private:
+  Material          material;            //!< A Material for all the Particles.
+};
+
+#endif /* _SPRITE_PARTICLE_SYSTEM_H */
Index: /branches/new_class_id/src/world_entities/playable.cc
===================================================================
--- /branches/new_class_id/src/world_entities/playable.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/playable.cc	(revision 9758)
@@ -30,6 +30,6 @@
 #include "game_rules.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "shared_network_data.h"
Index: /branches/new_class_id/src/world_entities/projectiles/bomb.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/bomb.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/bomb.cc	(revision 9758)
@@ -20,6 +20,6 @@
 #include "primitive_model.h"
 
-#include "dot_emitter.h"
-#include "particle_system.h"
+#include "particles/dot_emitter.h"
+#include "particles/particle_system.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/projectiles/boomerang_projectile.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/boomerang_projectile.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/boomerang_projectile.cc	(revision 9758)
@@ -21,6 +21,6 @@
 #include "state.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/projectiles/guided_missile.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/guided_missile.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/guided_missile.cc	(revision 9758)
@@ -20,6 +20,6 @@
 #include "state.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/projectiles/hyperblast.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/hyperblast.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/hyperblast.cc	(revision 9758)
@@ -20,6 +20,6 @@
 #include "state.h"
 
-#include "box_emitter.h"
-#include "spark_particles.h"
+#include "particles/box_emitter.h"
+#include "particles/spark_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/projectiles/laser.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/laser.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/laser.cc	(revision 9758)
@@ -21,6 +21,6 @@
 #include "model.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include <cassert>
Index: /branches/new_class_id/src/world_entities/projectiles/rail_projectile.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/rail_projectile.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/rail_projectile.cc	(revision 9758)
@@ -21,6 +21,6 @@
 #include "model.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include <cassert>
Index: /branches/new_class_id/src/world_entities/projectiles/rocket.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/rocket.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/rocket.cc	(revision 9758)
@@ -20,6 +20,6 @@
 #include "state.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/projectiles/test_bullet.cc
===================================================================
--- /branches/new_class_id/src/world_entities/projectiles/test_bullet.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/projectiles/test_bullet.cc	(revision 9758)
@@ -20,6 +20,6 @@
 #include "state.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 #include "debug.h"
 
Index: /branches/new_class_id/src/world_entities/space_ships/cruizer.cc
===================================================================
--- /branches/new_class_id/src/world_entities/space_ships/cruizer.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/space_ships/cruizer.cc	(revision 9758)
@@ -29,6 +29,6 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /branches/new_class_id/src/world_entities/space_ships/space_ship.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/space_ships/space_ship.cc	(revision 9758)
@@ -26,6 +26,6 @@
 #include "weapons/cannon.h"
 
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "util/loading/factory.h"
Index: /branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc
===================================================================
--- /branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/space_ships/spacecraft_2d.cc	(revision 9758)
@@ -30,6 +30,6 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
Index: /branches/new_class_id/src/world_entities/space_ships/turbine_hover.cc
===================================================================
--- /branches/new_class_id/src/world_entities/space_ships/turbine_hover.cc	(revision 9757)
+++ /branches/new_class_id/src/world_entities/space_ships/turbine_hover.cc	(revision 9758)
@@ -29,6 +29,6 @@
 
 #include "graphics_engine.h"
-#include "dot_emitter.h"
-#include "sprite_particles.h"
+#include "particles/dot_emitter.h"
+#include "particles/sprite_particles.h"
 
 #include "debug.h"
