Index: orxonox/trunk/src/lib/Makefile.am
===================================================================
--- orxonox/trunk/src/lib/Makefile.am	(revision 4415)
+++ orxonox/trunk/src/lib/Makefile.am	(revision 4416)
@@ -4,4 +4,5 @@
 SUBDIRS = graphics \
 	  physics \
+	  particles \
 	  tinyxml \
 	  $(GTK_PROGS)
Index: orxonox/trunk/src/lib/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/Makefile.in	(revision 4416)
@@ -169,4 +169,5 @@
 SUBDIRS = graphics \
 	  physics \
+	  particles \
 	  tinyxml \
 	  $(GTK_PROGS)
@@ -184,7 +185,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/graphics/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/graphics/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/graphics/Makefile.in	(revision 4416)
@@ -177,7 +177,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/graphics/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/graphics/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/graphics/importer/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/graphics/importer/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/graphics/importer/Makefile.in	(revision 4416)
@@ -181,7 +181,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/graphics/importer/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/graphics/importer/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/gui/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/gui/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/gui/Makefile.in	(revision 4416)
@@ -179,7 +179,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/gui/console/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/gui/console/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/gui/console/Makefile.in	(revision 4416)
@@ -205,7 +205,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/gui/gui/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/gui/gui/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/gui/gui/Makefile.in	(revision 4416)
@@ -242,7 +242,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/particles/Makefile.am
===================================================================
--- orxonox/trunk/src/lib/particles/Makefile.am	(revision 4416)
+++ orxonox/trunk/src/lib/particles/Makefile.am	(revision 4416)
@@ -0,0 +1,43 @@
+MAINSRCDIR=../..
+AM_CXXFLAGS=-I$(MAINSRCDIR)
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/world_entities
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/story_entities
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/coord
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/data
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/particles
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui/gui
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/lang
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/util
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/math
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics/fields
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/tinyxml
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/defs
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/font
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/network
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/glmenu
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/ai
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/animation
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/common
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/loading
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/util/track
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/subprojects
+
+
+noinst_LIBRARIES = libORXparticles.a 
+
+libORXparticles_a_SOURCES = particle_engine.cc \
+		       	  particle_emitter.cc \
+		          particle_system.cc \
+		          quick_animation.cc 
+
+
+noinst_HEADERS= particle_engine.h \
+		particle_emitter.h \
+		particle_system.h \
+		quick_animation.h
Index: orxonox/trunk/src/lib/particles/particle_emitter.cc
===================================================================
--- orxonox/trunk/src/lib/particles/particle_emitter.cc	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_emitter.cc	(revision 4416)
@@ -0,0 +1,191 @@
+/* 
+   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_PARTICLE
+
+#include "particle_emitter.h"
+
+#include "particle_system.h"
+#include "particle_engine.h"
+
+#include "debug.h"
+#include "stdlibincl.h"
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+ParticleEmitter::ParticleEmitter(const Vector& direction, float angle, float emissionRate, 
+		  float velocity)
+{
+   this->setClassID(CL_PARTICLE_EMITTER, "ParticleEmitter");
+
+   this->type = EMITTER_DOT;
+   this->emitterSize = 1.0;
+   this->direction = direction;
+   this->setSpread(angle);
+   this->setEmissionRate(emissionRate);
+   this->setEmissionVelocity(velocity);
+
+   this->saveTime = 0.0;
+
+   ParticleEngine::getInstance()->addEmitter(this);
+}
+
+
+
+/**
+   \brief standard destructor
+
+*/
+ParticleEmitter::~ParticleEmitter () 
+{
+  ParticleEngine::getInstance()->removeEmitter(this);
+}
+
+
+/**
+   \brief this start the emitter
+*/
+void ParticleEmitter::start() {}
+
+
+/**
+   \brief this stops the emitter
+*/
+void ParticleEmitter::stop() {}
+
+
+
+
+/* these are Animation interfaces: so you can change spec values as you want */
+
+/**
+   \param type the new Type of this emitter
+*/
+void ParticleEmitter::setType(EMITTER_TYPE type)
+{
+  this->type = type;
+}
+
+void ParticleEmitter::setSize(float emitterSize)
+{
+  if (emitterSize > 0.0)
+    this->emitterSize = emitterSize;
+  else
+    emitterSize = 0.0;
+}
+
+/**
+   \brief set the emission rate
+   \param 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;
+}
+
+/**
+   \brief 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;
+}
+
+/**
+   \brief sets the velocity of all particles emitted
+   \param velocity The starting velocity of the emitted particles
+   \param random 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;
+}
+
+/**
+   \brief this set the time to life of a particle, after which it will die
+   \param the time to live in seconds
+
+   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, ParticleSystem* system)
+{
+  if (likely(dt > 0.0 && this->emissionRate > 0.0))
+  {
+    // saving the time
+    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 round\n", count, this->saveTime); 
+    
+    if (likely(count > 0))
+      {
+	Vector inheritVelocity = this->getVelocity() * system->inheritSpeed;
+	for (int i = 0; i < count; i++)
+	  // emmits from EMITTER_DOT,
+	  {
+	    Vector randDir = Vector(rand()-RAND_MAX/2, rand()-RAND_MAX/2, rand()-RAND_MAX/2);
+	    randDir.normalize();
+	    randDir = (this->getAbsDir()*Quaternion(angle + randomAngle *((float)rand()/RAND_MAX -.5), randDir)).apply(this->direction);
+	    Vector velocityV = randDir.getNormalized()*this->velocity + inheritVelocity;
+
+	    // this should spread the Particles evenly. if the Emitter is moved around quickly
+	    Vector equalSpread = this->getVelocity() * rand()/RAND_MAX * dt;
+	    Vector extension; // the Vector for different fields.
+
+	    if (this->type & 2)
+	      {
+		extension = Vector(this->emitterSize * ((float)rand()/RAND_MAX -.5), 0, this->emitterSize * ((float)rand()/RAND_MAX - .5));
+		extension = this->getAbsDir().apply(extension);
+	      }
+	    else if (this->type & 8)
+	      {
+		extension = Vector((float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5, (float)rand()/RAND_MAX -.5) * this->emitterSize;
+	      }
+
+	    system->addParticle(this->getAbsCoor() + extension - equalSpread, velocityV);
+	    
+	  }
+      }
+  }
+}
+
+/**
+   \brief outputs some nice debug information
+*/
+void ParticleEmitter::debug(void)
+{
+
+}
Index: orxonox/trunk/src/lib/particles/particle_emitter.h
===================================================================
--- orxonox/trunk/src/lib/particles/particle_emitter.h	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_emitter.h	(revision 4416)
@@ -0,0 +1,67 @@
+/*! 
+    \file particle_emitter.h
+    \brief Definition of a ParticleEmitter
+*/
+
+#ifndef _PARTICLE_EMITTER_H
+#define _PARTICLE_EMITTER_H
+
+#include "p_node.h"
+
+// FORWARD DEFINITION 
+struct Particle;
+class ParticleSystem;
+
+//! The form of the Emitter to emit from
+typedef enum EMITTER_TYPE {EMITTER_DOT   = 1,
+			   EMITTER_PLANE = 2,
+			   EMITTER_SPHERE= 4,
+			   EMITTER_CUBE  = 8};
+
+//! A class to handle an Emitter.
+class ParticleEmitter : public PNode {
+
+ public:
+  ParticleEmitter(const Vector& direction, float angle = .5,
+		  float emissionRate = 1.0, float velocity = 1.0);
+  virtual ~ParticleEmitter(void);
+
+  /* controlling the emitter: interface */
+  void start();
+  void stop();
+  void tick(float dt, ParticleSystem* system);
+
+  /* controlling the behavour: these can be used as Animation interfaces */
+  void setType(EMITTER_TYPE type);
+  void setSize(float emitterSize);
+  void setEmissionRate(float emissionRate);
+  void setSpread(float angle, float randomAngle = 0.0);
+  void setEmissionVelocity(float velocity, float randomVelocity = 0.0);
+
+  /** \returns the type of the emitter */
+  inline EMITTER_TYPE getType(void) const { return this->type; };
+  /** \returns the Size of the emitter */
+  inline float getSize(void) const { return this->emitterSize; };
+  /** \returns the emissionRate */
+  inline float getEmissionRate(void) const { return this->emissionRate; };
+  /** \returns the SpreadAngle of the emitter */
+  inline float getSpread(void) { return this->angle; };
+  /** \returns the EmissionVelocity of the emitter */
+  inline float getEmissionVelocity(void) { return this->velocity; };
+
+  void debug(void);
+
+ private:
+  EMITTER_TYPE type;    //!< The type of emitter this is
+  float emitterSize;    //!< The size of the emitter (not for EMITTER_DOT)
+  Vector direction;     //!< emition direction
+  float angle;          //!< max angle from the direction of the emitter
+  float randomAngle;    //!< random emission angle (angle +- angleRandom is the emitted angle.
+  float emissionRate;   //!< amount of particles per seconds emitted by emitter.
+  float velocity;       //!< the initial speed of a Particles.
+  float randomVelocity; //!< the random variation from the initial Speed.
+
+  float saveTime;       //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big).
+};
+
+#endif /* _PARTICLE_EMITTER_H */
Index: orxonox/trunk/src/lib/particles/particle_engine.cc
===================================================================
--- orxonox/trunk/src/lib/particles/particle_engine.cc	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_engine.cc	(revision 4416)
@@ -0,0 +1,398 @@
+/* 
+   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_PARTICLE
+
+#include "particle_engine.h"
+
+#include "particle_system.h"
+#include "particle_emitter.h"
+
+#include "list.h"
+#include "debug.h"
+#include "stdlibincl.h"
+
+using namespace std;
+
+/**
+   \brief standard constructor
+*/
+ParticleEngine::ParticleEngine () 
+{
+   this->setClassID(CL_PARTICLE_ENGINE, "ParticleEngine");
+
+   this->systemList = new tList<ParticleSystem>;
+   this->emitterList = new tList<ParticleEmitter>;
+   this->connectionList = new tList<ParticleConnection>;
+}
+
+/**
+   \brief the singleton reference to this class
+*/
+ParticleEngine* ParticleEngine::singletonRef = NULL;
+
+/**
+   \returns a Pointer to this Class
+*/
+ParticleEngine* ParticleEngine::getInstance(void)
+{
+  if (!ParticleEngine::singletonRef)
+    ParticleEngine::singletonRef = new ParticleEngine();
+  return ParticleEngine::singletonRef;
+}
+
+/**
+   \brief deletes all the system, emitters, connections and Lists
+*/
+ParticleEngine::~ParticleEngine () 
+{
+  // delete all remaining systems
+  tIterator<ParticleSystem>* sysIt = this->systemList->getIterator();
+  ParticleSystem* tmpSys = sysIt->nextElement();
+  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->nextElement();
+  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 Adds a System to the System list.
+
+   this is done automatically when creating a ParticleSystem
+*/
+void ParticleEngine::addSystem(ParticleSystem* system)
+{
+  this->systemList->add(system);
+}
+
+/**
+   \brief 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(ParticleEmitter* emitter, ParticleSystem* system)
+{
+  // look, if we have already added this connection
+  tIterator<ParticleConnection>* tmpConIt = connectionList->getIterator();
+  ParticleConnection* tmpConnection = tmpConIt->nextElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+	{
+	  PRINTF(2)("Connection between Emitter and System already added\n");
+	  delete tmpConIt;
+	  return;
+	}
+      
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+  
+
+
+  ParticleConnection* tmpCon = new ParticleConnection;
+  tmpCon->emitter = emitter;
+  tmpCon->system = system;
+
+  this->connectionList->add(tmpCon);
+}
+
+/**
+   \brief 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->nextElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->system == system)
+	this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the System from the systemList.
+  this->systemList->remove(system);
+}
+
+/**
+   \brief 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->nextElement();
+  while(tmpConnection)
+    {
+      if (tmpConnection->emitter == emitter)
+	this->breakConnection(tmpConnection);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+
+  // remove the emitter from the emitterList
+  this->emitterList->remove(emitter);
+}
+
+/**
+   \brief 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->nextElement();
+  while(tmpConnection)
+    {
+    if (tmpConnection->emitter == emitter && tmpConnection->system == system)
+      {
+	this->breakConnection(tmpConnection);
+	delete tmpConIt;
+	return true;
+      }
+    tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+  return false;
+}
+
+/**
+   \brief 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;
+}
+
+
+/**
+   \brief 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->nextElement();
+  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->nextElement();
+  while(tmpConnection)
+    {
+      tmpConnection->emitter->tick(dt, tmpConnection->system);
+      tmpConnection = tmpConIt->nextElement();
+    }
+  delete tmpConIt;
+}
+
+/**
+   \brief draws all the systems and their Particles.
+   \param dt the time passed in seconds (since the last Frame)
+*/
+void ParticleEngine::draw() const
+{
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->nextElement();
+  while(tmpSys)
+    {
+      tmpSys->draw();
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+
+}
+
+/**
+   \param systemName the name of the system to search for
+   \returns the system called by systemName or NULL if not found
+*/
+ParticleSystem* ParticleEngine::getSystemByName(const char* systemName) const
+{
+  tIterator<ParticleSystem>* tmpIt = systemList->getIterator();
+  ParticleSystem* tmpSys = tmpIt->nextElement();
+  while(tmpSys)
+    {
+      if (!strcmp(systemName, tmpSys->getName()))
+	{
+	  delete tmpIt;
+	  return tmpSys;
+	}
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+   \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->nextElement();
+  while(tmpSys)
+    {
+      count++;
+      if ( count == number)
+	{
+	  delete tmpIt;
+	  return tmpSys;
+	}
+      tmpSys = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+   \param emitterName the name of the emitter to search for
+   \returns the emitter called by emitterName or NULL if not found
+*/
+ParticleEmitter* ParticleEngine::getEmitterByName(const char* emitterName) const
+{
+  tIterator<ParticleEmitter>* tmpIt = emitterList->getIterator();
+  ParticleEmitter* tmpEmit = tmpIt->nextElement();
+  while(tmpEmit)
+    {
+      if (!strcmp(emitterName, tmpEmit->getName()))
+	{
+	  delete tmpIt;
+	  return tmpEmit;
+	}
+      tmpEmit = 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->nextElement();
+  while(tmpEmit)
+    {
+      count++;
+      if ( count == number)
+	{
+	  delete tmpIt;
+	  return tmpEmit;
+	}
+      tmpEmit = tmpIt->nextElement();
+    }
+  delete tmpIt;
+  return NULL;
+}
+
+/**
+   \brief outputs some nice debug information
+*/
+void ParticleEngine::debug(void)
+{
+  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->nextElement();
+      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->nextElement();
+      while(tmpSys)
+	{
+	  tmpSys->debug();
+	  tmpSys = tmpIt->nextElement();
+	}
+      delete tmpIt;
+    }
+
+  PRINT(0)("+--------------------------------PE-+\n");
+
+}
Index: orxonox/trunk/src/lib/particles/particle_engine.h
===================================================================
--- orxonox/trunk/src/lib/particles/particle_engine.h	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_engine.h	(revision 4416)
@@ -0,0 +1,63 @@
+/*! 
+    \file particle_engine.h
+    \brief Definition of the ParticleEngine
+*/
+
+#ifndef _PARTICLE_ENGINE_H
+#define _PARTICLE_ENGINE_H
+
+#include "base_object.h"
+#include "particle_system.h"
+#include "particle_emitter.h"
+
+// FORWARD DEFINITION 
+template<class T> class tList;
+
+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:
+  static ParticleEngine* getInstance(void);
+  virtual ~ParticleEngine(void);
+
+  void tick(float dt);
+  void draw(void) const;
+
+  void addSystem(ParticleSystem* system);
+  void addEmitter(ParticleEmitter* emitter);
+  void addConnection(ParticleEmitter* emitter, ParticleSystem* system);
+
+  bool removeSystem(ParticleSystem* system);
+  bool removeEmitter(ParticleEmitter* emitter);
+  bool breakConnection(ParticleEmitter* emitter, ParticleSystem* system);
+  bool breakConnection(ParticleConnection* connection);
+
+  ParticleSystem* getSystemByName(const char* systemName) const;
+  ParticleSystem* getSystemByNumber(unsigned int number) const;
+  ParticleEmitter* getEmitterByName(const char* emitterName) const;
+  ParticleEmitter* getEmitterByNumber(unsigned int number) const;
+
+  void debug();
+
+ private:
+  ParticleEngine(void);
+  static ParticleEngine* singletonRef;        //!< The reference to the engine.
+
+  tList<ParticleSystem>* systemList;          //!< A list of Systems handled by the ParticleEngine.
+  tList<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: orxonox/trunk/src/lib/particles/particle_system.cc
===================================================================
--- orxonox/trunk/src/lib/particles/particle_system.cc	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_system.cc	(revision 4416)
@@ -0,0 +1,495 @@
+/* 
+   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_PARTICLE
+
+#include "particle_system.h"
+
+#include "particle_emitter.h"
+#include "particle_engine.h"
+
+#include "field.h"
+
+#include "compiler.h"
+#include "material.h"
+#include "state.h"
+
+
+// needed to find the Position of the Camera
+#include "world.h"
+
+using namespace std;
+
+/**
+   \brief standard constructor
+   \param count the Count of particles in the System
+   \param type The Type of the ParticleSystem
+
+   \todo this constructor is not jet implemented - do it
+*/
+ParticleSystem::ParticleSystem (unsigned int maxCount, PARTICLE_TYPE type) : PhysicsInterface(this)
+{
+  this->setClassID(CL_PARTICLE_SYSTEM, "ParticleSystem");
+  this->material = NULL;
+  this->name = NULL;
+  this->maxCount = maxCount;
+  this->count = 0;
+  this->particles = NULL;
+  this->deadList = NULL;
+  this->setConserve(1);
+  this->setLifeSpan(1);
+  this->setInheritSpeed(0);
+  this->glID = NULL;
+  this->setRadius(1.0, 1.0, 0.0);
+  this->setType(type, 1);
+  this->setColor(1.0,1.0,1.0,1.0, .5,.5,.5,.5, .0,.0,.0,.0);
+  this->setMass(1.0, 0.0);
+  ParticleEngine::getInstance()->addSystem(this);
+}
+
+
+/**
+   \brief standard deconstructor
+*/
+ParticleSystem::~ParticleSystem()
+{
+  // delete what has to be deleted here
+   ParticleEngine::getInstance()->removeSystem(this);
+
+   // 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;
+     }
+
+   if (this->material)
+     delete this->material;
+}
+
+/**
+   \brief sets the Name of the Particle System
+   \param name the Name of the System
+*/
+void ParticleSystem::setName(const char* name)
+{
+  if (this->name)
+    delete this->name;
+  this->name = new char[strlen(name)+1];
+  strcpy(this->name, name);
+}
+
+/**
+   \returns the Name of the ParticleSystem
+*/
+const char* ParticleSystem::getName(void) const
+{
+  return this->name;
+}
+
+/**
+   \todo this will be different
+*/
+void ParticleSystem::setType(PARTICLE_TYPE particleType, int count)
+{
+  this->particleType = particleType;
+  this->dialectCount = count;
+  //  if (glID != NULL)
+  //    delete glID;
+
+  //  glID = new GLuint[count];
+  //  for (int i = 0; i< count; i++)
+  //    glID[i] = 0;
+
+  //  glID[0] = glGenLists(count);
+  if (this->material)
+    delete this->material;
+  this->material = NULL;
+
+  if (this->particleType == PARTICLE_SPRITE)
+    {
+      this->material = new Material("transperencyMap");
+      this->material->setDiffuseMap("pictures/radialTransparency.png");
+      //  material->setTransparency(.5);
+    }
+}
+
+// setting properties
+void ParticleSystem::setMaterial(Material* material)
+{
+  this->material = material;
+}
+
+
+
+/**
+   \brief 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 ParticleSystem::setInheritSpeed(float value)
+{
+  if (unlikely(value > 1.0))
+    this->inheritSpeed = 1;
+  else if (unlikely(value < 0.0))
+    this->inheritSpeed = 0;
+  else
+    this->inheritSpeed = value;
+}
+
+/**
+   \brief Sets the lifespan of newly created particles
+*/   
+void ParticleSystem::setLifeSpan(float lifeSpan, float randomLifeSpan)
+{
+  this->lifeSpan = lifeSpan;
+  this->randomLifeSpan = randomLifeSpan;
+}
+
+/**
+   \brief sets the radius of newly created particles
+*/
+void ParticleSystem::setRadius(float startRadius, float endRadius, float randomStartRadius, float randomEndRadius)
+{
+  this->startRadius = startRadius;
+  this->endRadius = endRadius;
+  this->randomStartRadius = randomStartRadius;
+  this->randomEndRadius = randomEndRadius;
+}
+
+/**
+   \brief sets the initial mass of any particle
+*/
+void ParticleSystem::setMass(float mass, float randomMass)
+{
+  this->initialMass = mass;
+  this->randomInitialMass = randomMass;
+}
+
+/**
+   \brief sets the conserve Factor of newly created particles
+*/
+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;
+}
+
+
+/**
+   \brief Tells the ParticleSystem how it should iterate the color over time
+   \param ....
+*/
+void ParticleSystem::setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba,
+			      GLfloat mr, GLfloat mg, GLfloat mb, GLfloat ma,
+			      GLfloat er, GLfloat eg, GLfloat eb, GLfloat ea)
+{
+  this->startColor[0] = br;
+  this->startColor[1] = bg;
+  this->startColor[2] = bb;
+  this->startColor[3] = ba;
+
+  this->midColor[0] = mr;
+  this->midColor[1] = mg;
+  this->midColor[2] = mb;
+  this->midColor[3] = ma;
+
+  this->endColor[0] = er;
+  this->endColor[1] = eg;
+  this->endColor[2] = eb;
+  this->endColor[3] = ea;
+}
+
+/**
+   \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;
+
+      // rendering new position.
+      tickPart->position = tickPart->position + tickPart->velocity * dt;
+      tickPart->radius += tickPart->radiusIt * dt;
+      
+      tickPart->extForce = Vector(0,0,0);
+
+      // applying Color
+      //! \todo better algorithm to do this \todo also implement the midColor
+      if (tickPart->lifeCycle < .5)
+	{
+	  tickPart->color[0] = this->startColor[0] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[0] *(tickPart->lifeCycle*2);
+	  tickPart->color[1] = this->startColor[1] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[1] *(tickPart->lifeCycle*2);
+	  tickPart->color[2] = this->startColor[2] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[2] *(tickPart->lifeCycle*2);
+	  tickPart->color[3] = this->startColor[3] *(1.0-tickPart->lifeCycle*2.0) + this->midColor[3] *(tickPart->lifeCycle*2);
+	}
+      else
+	{
+	  tickPart->color[0] = this->midColor[0] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[0] *(tickPart->lifeCycle*2);
+	  tickPart->color[1] = this->midColor[1] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[1] *(tickPart->lifeCycle*2);
+	  tickPart->color[2] = this->midColor[2] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[2] *(tickPart->lifeCycle*2);
+	  tickPart->color[3] = this->midColor[3] *(2.0-tickPart->lifeCycle*2.0) + this->endColor[3] *(tickPart->lifeCycle*2);
+	}	  
+      // many more to come
+
+      if (this->conserve < 1.0)
+	tickPart->velocity = tickPart->velocity * 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;
+	}
+    }
+}
+
+/** 
+    \brief applies some force to a Particle.
+    \param field the Field to apply.
+    \param dt The time over which the field gets applied
+ */
+void ParticleSystem::applyField(Field* field)
+{
+  Particle* tickPart = particles;
+  while (tickPart)
+    {
+      tickPart->extForce += field->calcForce(tickPart->position);
+      tickPart = tickPart->next;
+    }
+}
+
+
+/**
+   \brief draws all the Particles of this System
+   \param the time passed in seconds (since the last draw)
+
+   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 ParticleSystem::draw(void) const
+{
+  glPushAttrib(GL_ENABLE_BIT);
+  glDisable(GL_LIGHTING);
+
+  Particle* drawPart = particles;
+      
+  switch (this->particleType)
+    {
+    default:
+    case PARTICLE_SPRITE:
+      glMatrixMode(GL_MODELVIEW);
+      glDisable(GL_DEPTH_TEST);
+
+      material->select(); 
+      //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::getInstance()->getCamera();  //!< \todo MUST be different
+	  Vector cameraPos = camera->getAbsCoor();
+	  Vector cameraTargetPos = State::getInstance()->getCameraTarget()->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;
+	}
+
+      
+      break;
+
+    case PARTICLE_SPARK:
+      glEnable(GL_LINE_SMOOTH);
+      glBegin(GL_LINES);
+      while (likely(drawPart != NULL))
+	{
+	  glColor4fv(drawPart->color);
+	  glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+	  glVertex3f(drawPart->position.x - drawPart->velocity.x,
+		     drawPart->position.y - drawPart->velocity.y,
+		     drawPart->position.z - drawPart->velocity.z);
+	  drawPart = drawPart->next;
+	}
+      glEnd();
+      break;
+      
+    case PARTICLE_DOT:
+      glBegin(GL_POINTS);
+      while (likely(drawPart != NULL))
+	{
+	  glColor4fv(drawPart->color);
+
+	  glLineWidth(drawPart->radius);
+
+	  glVertex3f(drawPart->position.x, drawPart->position.y, drawPart->position.z);
+	  drawPart = drawPart->next;
+	}
+      glEnd();
+      break;
+    }
+  glPopAttrib();
+}
+
+/**
+   \brief adds a new Particle to the System
+   \param position the position where the particle gets emitted.
+   \param velocity the Starting velocity of the particle.
+   \param data some more data given by the emitter
+*/
+void ParticleSystem::addParticle(const Vector& position, const Vector& velocity, 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;
+
+      //  particle->rotation = ; //! \todo rotation is once again something to be done.
+      particles->mass = this->initialMass + (rand()/RAND_MAX -.5)* this->randomInitialMass;
+      particles->radius = this->startRadius + (rand()/RAND_MAX-.5)*this->randomStartRadius;
+      
+      particles->radiusIt = (this->endRadius + (rand()/RAND_MAX-.5)*this->randomEndRadius - particles->radius) / particles->lifeTime;
+
+      ++this->count;
+    }
+  else
+    PRINTF(5)("maximum count of particles reached not adding any more\n");
+}
+
+/**
+   \brief outputs some nice debug information
+*/
+void ParticleSystem::debug(void)
+{
+  PRINT(0)("  ParticleSystem %s\n", this->name);
+  PRINT(0)("  ParticleCount: %d, maximumCount: %d :: filled %d%%\n", this->count, this->maxCount, 100*this->count/this->maxCount);
+  if (deadList)
+    {
+      PRINT(0)("  - ParticleDeadList is used: ");
+      int i = 1;
+      Particle* tmpPart = this->deadList;
+      while (tmpPart = tmpPart->next) ++i;
+      PRINT(0)("count: %d\n", i);
+    }
+}
Index: orxonox/trunk/src/lib/particles/particle_system.h
===================================================================
--- orxonox/trunk/src/lib/particles/particle_system.h	(revision 4416)
+++ orxonox/trunk/src/lib/particles/particle_system.h	(revision 4416)
@@ -0,0 +1,140 @@
+/*! 
+    \file particle_system.h
+
+*/
+
+#ifndef _PARTICLE_SYSTEM_H
+#define _PARTICLE_SYSTEM_H
+
+#include "base_object.h"
+#include "physics_interface.h"
+
+#include "glincl.h"
+#include "vector.h"
+
+#define PARTICLE_DOT_MASK           0x000001
+#define PARTICLE_SPARK_MASK         0x000010
+#define PARTICLE_SPRITE_MASK        0x000100
+#define PARTICLE_MODEL_MASK         0x001000
+#define PARTICLE_WORDL_ENTITY_MASK  0x010000
+#define PARTICLE_MULTI_MASK         0x100000
+
+//! An enumerator for the different types of particles.
+typedef enum PARTICLE_TYPE {PARTICLE_DOT = PARTICLE_DOT_MASK,
+			    PARTICLE_SPARK = PARTICLE_SPARK_MASK,
+			    PARTICLE_SPRITE = PARTICLE_SPRITE_MASK,
+			    PARTICLE_MULTI_SPRITE = PARTICLE_SPRITE_MASK | PARTICLE_MULTI_MASK,
+			    PARTICLE_MODEL = PARTICLE_MODEL_MASK,
+			    PARTICLE_MULTI_MODE = PARTICLE_MODEL_MASK | PARTICLE_MULTI_MASK};
+
+#define PARTICLE_DEFAULT_MAX_COUNT    200               //!< a default count of particles in the system.
+#define PARTICLE_DEFAULT_TYPE         PARTICLE_SPRITE   //!< A default type of the system.
+
+// FORWARD DEFINITION
+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 rotation;        //!< The current rotation of this particle.
+  float mass;                 //!< The mass of this particle.
+  float radius;               //!< The current size of this particle.
+  float radiusIt;             //!< The difference of the Size per second.
+
+  GLfloat color [4];          //!< A Color for the particles.
+
+  PARTICLE_TYPE type;
+
+  Particle* next;             //!< pointer to the next particle in the List. (NULL if no preceding one)
+};
+
+//! A class to handle ParticleSystems
+class ParticleSystem : public PhysicsInterface {
+  friend class ParticleEmitter;
+  
+ public:
+  ParticleSystem(unsigned int maxCount = PARTICLE_DEFAULT_MAX_COUNT,
+		 PARTICLE_TYPE type = PARTICLE_DEFAULT_TYPE);
+  virtual ~ParticleSystem();
+  void setName(const char* name);
+  const char* getName(void) const;
+
+  void setType(PARTICLE_TYPE particleType, int count = 0);
+  void setMaterial(Material* material);
+  void setInheritSpeed(float value);
+  void setLifeSpan(float lifeSpan, float randomLifeSpan = 0.0);
+  void setRadius(float startRadius, float endRadius,
+		 float randomStartRadius = 0.0, float randomEndRadius = 0.0);
+  void setConserve(float conserve);
+  void setMass(float mass, float randomMass = 0.0);
+
+  void setColor(GLfloat br, GLfloat bg, GLfloat bb, GLfloat ba,
+		GLfloat mr, GLfloat mg, GLfloat mb, GLfloat ma,
+		GLfloat er, GLfloat eg, GLfloat eb, GLfloat ea);
+
+  /** \returns the Type of the particles */
+  inline PARTICLE_TYPE getType(void) const { return this->particleType; };
+  /** \returns the Material that lies on this particles */
+  inline const Material* getMaterial(void) const { return this->material; };
+  /** \returns the inherit-speed-factor */
+  inline float getInheritSpeed(void) const { return this->inheritSpeed; };
+  /** \returns the lifespan of the particles */
+  inline float getLifeSpan(void) const { return this->lifeSpan; };
+  /** \returns the starting-radius of the particles */
+  inline float getStartRadius(void) const { return this->startRadius; };
+  /** \returns the end-radius of the particles */
+  inline float getEndRadius(void) const { return this->endRadius; };
+  /** \returns the conserve-factor of the particles */
+  inline float getConserve(void) const { return this->conserve; };
+  /** \returns the initial mass of the particles */
+  inline float getMass(void) const { return this->initialMass; };
+
+  virtual void applyField(Field* field);
+  virtual void tickPhys(float dt) {};
+
+  void addParticle(const Vector& position, const Vector& velocity, unsigned int data = 0);
+
+  void tick(float dt);
+  void draw(void) const;
+
+  void debug(void);
+
+ private:
+  char* name;                // the Name of the Particle System
+
+  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 startRadius;         //!< The beginning Radius of the Particle
+  float endRadius;           //!< The end Radius of the Particle
+  float randomStartRadius;   //!< The Random start Radius (begin + rand*randomValue)
+  float randomEndRadius;     //!< Random end value
+  float initialMass;         //!< The initial Mass of the Particle
+  float randomInitialMass;   //!< The random initial Mass of the Particle
+  float inheritSpeed;        //!< How much speed the particle inherits from the Emitters speed \todo move this to the emitter
+
+  GLfloat startColor[4];     //!< Color of the Particle at the beginning
+  GLfloat midColor[4];       //!< Color of the Particle at the middle of its lifeSpan
+  GLfloat endColor[4];       //!< Color of the Particle at the end of its lifeSpan
+
+  // particles
+  int maxCount;              //!< The maximum count of Particles.
+  int count;                 //!< The current count of Particles.
+  PARTICLE_TYPE particleType;//!< A type for all the Particles
+  Material* material;        //!< A Material for all the Particles.
+  Particle* particles;       //!< A list of particles of this System.
+  Particle* deadList;        //!< A list of dead Particles in the System.
+
+  GLuint* glID;              //!< A List of different gl-List-ID's
+  GLuint dialectCount;       //!< How many different types of particles are there in the Particle System  
+};
+
+#endif /* _PARTICLE_SYSTEM_H */
Index: orxonox/trunk/src/lib/particles/quick_animation.cc
===================================================================
--- orxonox/trunk/src/lib/particles/quick_animation.cc	(revision 4416)
+++ orxonox/trunk/src/lib/particles/quick_animation.cc	(revision 4416)
@@ -0,0 +1,120 @@
+/* 
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific:
+   main-programmer: ...
+   co-programmer: ...
+*/
+
+//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
+
+#include "quick_animation.h"
+
+#include "compiler.h"
+#include "debug.h"
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+using namespace std;
+
+
+/**
+   \brief standard constructor
+*/
+QuickAnimation::QuickAnimation (float rangeStart, float valueStart, float rangeEnd, float valueEnd)
+{
+   this->setClassName("QuickAnimation");
+
+   this->first = this->current = new QuickKeyFrame;
+   this->current->positionStart = rangeStart;
+   this->current->positionEnd = rangeEnd;
+   this->current->valueStart = valueStart;
+   this->current->valueEnd = valueEnd;
+   this->current->next = NULL;
+}
+
+
+/**
+   \brief standard deconstructor
+
+*/
+QuickAnimation::~QuickAnimation () 
+{
+  this->current = this->first;
+  QuickKeyFrame delKF;
+  
+  while (this->current != NULL)
+    {
+      this->first = this->current->next;
+      delete this->current;
+      this->current = this->first;
+    }
+
+}
+
+
+void QuickAnimation::addEntry(float position, float value)
+{
+  this->current = this->first;
+  if (position < this->current->positionStart)
+    {
+      this->current = new QuickKeyFrame;
+
+      this->current->positionStart = position;
+      this->current->positionEnd = this->first->positionStart;
+
+      this->current->valueStart = value;
+      this->current->valueEnd = this->first->valueStart;
+      
+      this->current->next = this->first;
+      this->first = this->current;
+    }
+  
+  while(this->current != NULL)
+    {
+      if (this->current->positionStart < position)
+	{
+	  QuickKeyFrame* tmpKey = new QuickKeyFrame;
+	  tmpKey->positionStart = position;
+	  tmpKey->positionEnd = this->current->positionEnd;
+	  tmpKey->valueStart = value;
+	  tmpKey->valueEnd = this->current->valueEnd;
+	  tmpKey->next = this->current->next;
+	  
+	  this->current->positionEnd = tmpKey->positionStart;
+	  this->current->valueEnd = tmpKey->valueStart;
+	}
+    }
+}
+
+
+float QuickAnimation::getValue(float position)
+{
+  while (likely (this->current->positionStart > position || this->current->positionEnd < position))
+    {
+      if (likely(this->current->next != NULL))
+	this->current = this->current->next;
+      else
+	{
+	  if (unlikely(this->first->positionStart > position))
+	    {
+	      PRINTF(2)("Position out of range. chose %f, min is: %f, max is\n", position, this->first->positionStart, this->current->positionEnd);
+	      return 0;
+	    }
+	  this->current = this->first;
+	}
+    }
+  return this->current->valueStart + (this->current->positionEnd - position) *
+    (this->current->valueEnd - this->current->valueStart) /
+    (this->current->positionEnd - this->current->positionStart);
+}
+
Index: orxonox/trunk/src/lib/particles/quick_animation.h
===================================================================
--- orxonox/trunk/src/lib/particles/quick_animation.h	(revision 4416)
+++ orxonox/trunk/src/lib/particles/quick_animation.h	(revision 4416)
@@ -0,0 +1,51 @@
+/*! 
+    \file quick_animation.h
+    \brief Definition of the QuickAnimation-class
+
+*/
+
+#ifndef _QUICK_ANIMATION_H
+#define _QUICK_ANIMATION_H
+
+#include "base_object.h"
+
+// FORWARD DEFINITION
+
+
+
+
+//! A class for that linearely interpolates between multiple values.
+/**
+   to be quick this only has the capability to store very little date
+
+   this class is optimized for a raising value. eg. 100 particles sorted
+   by age.
+*/
+class QuickAnimation : public BaseObject {
+
+ public:
+  //! a simple struct that stores keyframes for the QuickAnimation-Class.
+  struct QuickKeyFrame
+  {
+    float valueStart;       //!< The starting value of this KeyFrame
+    float valueEnd;         //!< The end value of this KeyFrame
+    float positionStart;    //!< The starting position of this KeyFrame
+    float positionEnd;      //!< The end position of thies KeyFrame
+
+    QuickKeyFrame* next;    //!< The next Animation
+  };
+
+  QuickAnimation(float rangeStart = 0.0, float valueStart = 0.0, float rangeEnd = 1.0, float valueEnd = 0.0);
+  virtual ~QuickAnimation();
+
+  void addEntry(float position, float value);
+
+  float getValue(float position);
+
+ private:
+  QuickKeyFrame* first;
+  QuickKeyFrame* current;
+
+};
+
+#endif /* _QUICK_ANIMATION_H */
Index: orxonox/trunk/src/lib/physics/Makefile.am
===================================================================
--- orxonox/trunk/src/lib/physics/Makefile.am	(revision 4415)
+++ orxonox/trunk/src/lib/physics/Makefile.am	(revision 4416)
@@ -8,5 +8,5 @@
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
-AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/particles
+AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/particles
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui
 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui/gui
Index: orxonox/trunk/src/lib/physics/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/physics/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/physics/Makefile.in	(revision 4416)
@@ -187,5 +187,5 @@
 target_vendor = @target_vendor@
 MAINSRCDIR = ../..
-AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/lib/physics -I$(MAINSRCDIR)/lib/physics/fields -I$(MAINSRCDIR)/lib/tinyxml -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/loading -I$(MAINSRCDIR)/util/track -I$(MAINSRCDIR)/subprojects
+AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/lib/physics -I$(MAINSRCDIR)/lib/physics/fields -I$(MAINSRCDIR)/lib/tinyxml -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/loading -I$(MAINSRCDIR)/util/track -I$(MAINSRCDIR)/subprojects
 noinst_LIBRARIES = libORXphysics.a 
 libORXphysics_a_SOURCES = physics_interface.cc \
@@ -218,7 +218,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/physics/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/physics/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/physics/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/physics/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
Index: orxonox/trunk/src/lib/tinyxml/Makefile.in
===================================================================
--- orxonox/trunk/src/lib/tinyxml/Makefile.in	(revision 4415)
+++ orxonox/trunk/src/lib/tinyxml/Makefile.in	(revision 4416)
@@ -204,7 +204,7 @@
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/tinyxml/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/tinyxml/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  src/lib/tinyxml/Makefile
+	  $(AUTOMAKE) --foreign  src/lib/tinyxml/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
