Index: /branches/new_class_id/src/Makefile.am
===================================================================
--- /branches/new_class_id/src/Makefile.am	(revision 9759)
+++ /branches/new_class_id/src/Makefile.am	(revision 9760)
@@ -36,12 +36,4 @@
 		lib/shell/some_shell_commands.cc \
 		orxonox.cc \
-		\
-		lib/graphics/effects/fog_effect.cc \
-		lib/graphics/effects/volfog_effect.cc \
-		lib/graphics/effects/rain_effect.cc \
-		lib/graphics/effects/snow_effect.cc \
-		lib/graphics/effects/cloud_effect.cc \
-		lib/graphics/effects/lightning_effect.cc \
-		lib/graphics/effects/lense_flare.cc \
 		\
 		util/multiplayer_team_deathmatch.cc \
Index: /branches/new_class_id/src/lib/graphics/Makefile.am
===================================================================
--- /branches/new_class_id/src/lib/graphics/Makefile.am	(revision 9759)
+++ /branches/new_class_id/src/lib/graphics/Makefile.am	(revision 9760)
@@ -18,17 +18,5 @@
 		text_engine/limited_width_text.cc \
 		text_engine/font.cc \
-		text_engine/font_data.cc \
-		\
-		effects/graphics_effect.cc \
-		effects/atmospheric_engine.cc \
-		effects/weather_effect.cc \
-		effects/sun_effect.cc \
-		effects/fog_effect.cc \
-		effects/volfog_effect.cc \
-		effects/rain_effect.cc \
-		effects/snow_effect.cc \
-		effects/cloud_effect.cc \
-		effects/lightning_effect.cc \
-		effects/lense_flare.cc
+		text_engine/font_data.cc
 
 noinst_HEADERS =\
@@ -47,17 +35,5 @@
 		text_engine/font.h \
 		text_engine/font_data.h \
-		text_engine/default_font.xpm \
-		\
-		effects/graphics_effect.h \
-		effects/atmospheric_engine.h \
-		effects/weather_effect.h \
-		effects/sun_effect.h \
-		effects/fog_effect.h \
-		effects/volfog_effect.h \
-		effects/rain_effect.h \
-		effects/snow_effect.h \
-		effects/cloud_effect.h \
-		effects/lightning_effect.h \
-		effects/lense_flare.h
+		text_engine/default_font.xpm
 
 
Index: /branches/new_class_id/src/lib/graphics/graphics_engine.cc
===================================================================
--- /branches/new_class_id/src/lib/graphics/graphics_engine.cc	(revision 9759)
+++ /branches/new_class_id/src/lib/graphics/graphics_engine.cc	(revision 9760)
@@ -35,7 +35,5 @@
 #include "texture.h"
 
-#include "effects/graphics_effect.h"
-#include "effects/fog_effect.h"
-#include "effects/lense_flare.h"
+#include "weather_effects/graphics_effect.h"
 
 #include "shell_command.h"
Index: /branches/new_class_id/src/story_entities/game_world.cc
===================================================================
--- /branches/new_class_id/src/story_entities/game_world.cc	(revision 9759)
+++ /branches/new_class_id/src/story_entities/game_world.cc	(revision 9760)
@@ -43,5 +43,5 @@
 
 #include "graphics_engine.h"
-#include "effects/atmospheric_engine.h"
+#include "weather_effects/atmospheric_engine.h"
 #include "event_handler.h"
 #include "sound_engine.h"
Index: /branches/new_class_id/src/story_entities/game_world_data.cc
===================================================================
--- /branches/new_class_id/src/story_entities/game_world_data.cc	(revision 9759)
+++ /branches/new_class_id/src/story_entities/game_world_data.cc	(revision 9760)
@@ -44,6 +44,6 @@
 
 #include "graphics_engine.h"
-#include "effects/graphics_effect.h"
-#include "effects/atmospheric_engine.h"
+#include "weather_effects/graphics_effect.h"
+#include "weather_effects/atmospheric_engine.h"
 #include "event_handler.h"
 #include "sound_engine.h"
Index: /branches/new_class_id/src/world_entities/WorldEntities.am
===================================================================
--- /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9759)
+++ /branches/new_class_id/src/world_entities/WorldEntities.am	(revision 9760)
@@ -86,5 +86,19 @@
 		world_entities/particles/dot_particles.cc \
 		\
-		world_entities/particles/quick_animation.cc
+		world_entities/particles/quick_animation.cc \
+		\
+		\
+		world_entities/weather_effects/graphics_effect.cc \
+		world_entities/weather_effects/atmospheric_engine.cc \
+		world_entities/weather_effects/weather_effect.cc \
+		world_entities/weather_effects/sun_effect.cc \
+		world_entities/weather_effects/fog_effect.cc \
+		world_entities/weather_effects/volfog_effect.cc \
+		world_entities/weather_effects/rain_effect.cc \
+		world_entities/weather_effects/snow_effect.cc \
+		world_entities/weather_effects/cloud_effect.cc \
+		world_entities/weather_effects/lightning_effect.cc \
+		world_entities/weather_effects/lense_flare.cc
+
 
 
@@ -175,4 +189,17 @@
 		particles/dot_particles.h \
 		\
-		particles/quick_animation.h
-
+		particles/quick_animation.h \
+		\
+		\
+		weather_effects/graphics_effect.h \
+		weather_effects/atmospheric_engine.h \
+		weather_effects/weather_effect.h \
+		weather_effects/sun_effect.h \
+		weather_effects/fog_effect.h \
+		weather_effects/volfog_effect.h \
+		weather_effects/rain_effect.h \
+		weather_effects/snow_effect.h \
+		weather_effects/cloud_effect.h \
+		weather_effects/lightning_effect.h \
+		weather_effects/lense_flare.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 9759)
+++ /branches/new_class_id/src/world_entities/particles/dot_particles.cc	(revision 9760)
@@ -22,5 +22,4 @@
 #include "material.h"
 #include "state.h"
-#include "shell_command.h"
 
 #include "class_id_DEPRECATED.h"
@@ -28,8 +27,4 @@
 ObjectListDefinitionID(DotParticles, CL_DOT_PARTICLES);
 CREATE_FACTORY(DotParticles);
-
-SHELL_COMMAND(texture, DotParticles, setMaterialTexture)
-    ->defaultValues("maps/evil-flower.png");
-
 
 
@@ -80,6 +75,4 @@
 {
   ParticleSystem::loadParams(root);
-
-  LoadParam(root, "texture", this, DotParticles, setMaterialTexture);
 }
 
Index: /branches/new_class_id/src/world_entities/particles/dot_particles.h
===================================================================
--- /branches/new_class_id/src/world_entities/particles/dot_particles.h	(revision 9759)
+++ /branches/new_class_id/src/world_entities/particles/dot_particles.h	(revision 9760)
@@ -22,6 +22,4 @@
   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; };
Index: /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.cc	(revision 9760)
@@ -0,0 +1,114 @@
+/*
+   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: Andreas Maechler, David Hasenfratz
+   co-programmer: ...
+*/
+
+#include "atmospheric_engine.h"
+
+#include "util/loading/resource_manager.h"
+
+#include "weather_effects/fog_effect.h"
+
+#include "util/loading/load_param_xml.h"
+#include "util/loading/factory.h"
+
+ObjectListDefinition(AtmosphericEngine);
+
+/**
+ * @param root The XML-element to load the AtmosphericEngine from
+ */
+AtmosphericEngine::AtmosphericEngine()
+{
+  this->registerObject(this, AtmosphericEngine::_objectList);
+}
+
+/**
+ *  The Pointer to this AtmosphericEngine
+*/
+AtmosphericEngine* AtmosphericEngine::singletonRef = NULL;
+
+
+/**
+ *  destroys a AtmosphericEngine
+ */
+AtmosphericEngine::~AtmosphericEngine()
+{
+  AtmosphericEngine::singletonRef = NULL;
+
+  while(!WeatherEffect::objectList().empty())
+    delete WeatherEffect::objectList().front();
+}
+
+/**
+ * @param root The XML-element to load the AtmosphericEngine from
+ */
+void AtmosphericEngine::loadParams(const TiXmlElement* root)
+{
+  LoadParamXML(root, "WeatherEffect", this, AtmosphericEngine, loadWeatherEffect);
+  LoadParamXML(root, "SunEffect", this, AtmosphericEngine, loadSunEffect);
+}
+
+/**
+ * @param root The XML-element to load WeatherEffects from
+ */
+void AtmosphericEngine::loadWeatherEffect(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    PRINTF(4)("element is: %s\n", element->Value());
+    // Factory::fabricate(element);
+
+    BaseObject* bo = Factory::fabricate(element);
+    if( bo == NULL)
+      PRINTF(0)(" Could not create Element %s\n", element->Value());
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @param root The XML-element to load SunEffects from
+ */
+void AtmosphericEngine::loadSunEffect(const TiXmlElement* root)
+{
+  LOAD_PARAM_START_CYCLE(root, element);
+  {
+    PRINTF(4)("element is: %s\n", element->Value());
+  }
+  LOAD_PARAM_END_CYCLE(element);
+}
+
+
+/**
+ * draws the effect, if needed
+ */
+void AtmosphericEngine::draw() const
+{
+  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
+       it != WeatherEffect::objectList().end();
+       ++it)
+    (*it)->draw();
+}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void AtmosphericEngine::tick(float dt)
+{
+
+  for (ObjectList<WeatherEffect>::const_iterator it = WeatherEffect::objectList().begin();
+       it != WeatherEffect::objectList().end();
+       ++it)
+    (*it)->tick(dt);
+}
Index: /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/atmospheric_engine.h	(revision 9760)
@@ -0,0 +1,43 @@
+/*!
+ * @file atmospheric_engine.h
+ *
+ */
+
+#ifndef _ATMOSPHERIC_ENGINE_H
+#define _ATMOSPHERIC_ENGINE_H
+
+#include "base_object.h"
+
+
+class TiXmlElement;
+
+class AtmosphericEngine : public BaseObject
+{
+  ObjectListDeclaration(AtmosphericEngine);
+  public:
+    ~AtmosphericEngine();
+
+    /** @returns a Pointer to the only object of this Class */
+    inline static AtmosphericEngine* getInstance() { if (!AtmosphericEngine::singletonRef) AtmosphericEngine::singletonRef = new AtmosphericEngine();  return AtmosphericEngine::singletonRef; };
+
+    void loadParams(const TiXmlElement* root);
+
+    void init();
+
+    void draw() const;
+    void tick(float dt);
+
+    // inline bool isActivated() const { return this->bActivated; }
+
+    void loadWeatherEffect(const TiXmlElement* root);
+    void loadSunEffect(const TiXmlElement* root);
+
+  private:
+
+    AtmosphericEngine();
+
+    static AtmosphericEngine*     singletonRef;       //!< Pointer to the only instance of this Class
+};
+
+
+#endif /* _ATMOSPHERIC_ENGINE */
Index: /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.cc	(revision 9760)
@@ -0,0 +1,453 @@
+/*
+  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: hdavid, amaechler
+
+  INSPIRED BY http://www.codesampler.com/usersrc/usersrc_6.htm#oglu_sky_dome_shader
+*/
+
+#include "cloud_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/resource_manager.h"
+
+#include "material.h"
+#include "state.h"
+#include "p_node.h"
+#include "shader.h"
+#include "shell_command.h"
+#include "t_animation.h"
+#include "script_class.h"
+
+#include "class_id_DEPRECATED.h"
+
+Vector    CloudEffect::cloudColor;
+Vector    CloudEffect::skyColor;
+Vector    CloudEffect::newCloudColor;
+Vector    CloudEffect::newSkyColor;
+
+bool      CloudEffect::fadeSky;
+bool      CloudEffect::fadeCloud;
+float     CloudEffect::fadeTime;
+
+ObjectListDefinitionID(CloudEffect, CL_CLOUD_EFFECT);
+
+
+SHELL_COMMAND(activate, CloudEffect, activateCloud);
+SHELL_COMMAND(deactivate, CloudEffect, deactivateCloud);
+SHELL_COMMAND(skyColor, CloudEffect, shellSkyColor);
+SHELL_COMMAND(cloudColor, CloudEffect, shellCloudColor);
+
+
+CREATE_SCRIPTABLE_CLASS(CloudEffect,
+                        addMethod("skyColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellSkyColor))
+                        ->addMethod("cloudColor", Executor4<CloudEffect, lua_State*,float,float,float,float>(&CloudEffect::shellCloudColor))
+                        ->addMethod("activate", Executor0<CloudEffect, lua_State*>(&CloudEffect::activate))
+                        ->addMethod("deactivate", Executor0<CloudEffect, lua_State*>(&CloudEffect::deactivate))
+                       );
+
+
+CREATE_FACTORY(CloudEffect);
+
+CloudEffect::CloudEffect(const TiXmlElement* root) {
+  this->registerObject(this, CloudEffect::_objectList);
+
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    if(cloudActivate)
+        this->activate();
+}
+
+CloudEffect::~CloudEffect() {
+    this->deactivate();
+
+    if (glIsTexture(noise3DTexName))
+        glDeleteTextures(1, &noise3DTexName);
+
+    delete shader;
+}
+
+
+void CloudEffect::init() {
+    PRINTF(0)("Initializing CloudEffect\n");
+
+    // default values
+    this->offsetZ = 0;
+    this->animationSpeed = 2;
+    this->scale = 0.0004f;
+    this->atmosphericRadius = 4000;
+    this->planetRadius = 1500;
+    this->divs = 15;
+    this->cloudActivate = false;
+    fadeSky = false;
+    fadeCloud = false;
+
+
+    skyColor = Vector(0.0f, 0.0f, 0.8f);
+    cloudColor = Vector(0.8f, 0.8f, 0.8f);
+    newSkyColor = skyColor;
+    newCloudColor = cloudColor;
+
+    this->noise3DTexSize = 128;
+    this->noise3DTexName = 0;
+
+    this->make3DNoiseTexture();
+
+    glGenTextures(1, &noise3DTexName);
+    glBindTexture(GL_TEXTURE_3D, noise3DTexName);
+
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_REPEAT);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+
+    glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA,
+                 noise3DTexSize, noise3DTexSize, noise3DTexSize,
+                 0, GL_RGBA, GL_UNSIGNED_BYTE, noise3DTexPtr);
+
+    this->skydome = new Skydome();
+    this->skydome->setTexture(noise3DTexName);
+
+    this->shader = new Shader(ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.vert",
+                              ResourceManager::getInstance()->getDataDir() + "/shaders/cloud.frag");
+
+    this->shader->activateShader();
+
+    Shader::Uniform(shader, "Noise").set(0);
+
+    this->offset = new Shader::Uniform(shader, "Offset");
+    this->skycolor = new Shader::Uniform(shader, "SkyColor");
+    this->cloudcolor = new Shader::Uniform(shader, "CloudColor");
+
+    this->shader->deactivateShader();
+
+    this->skydome->setShader(shader);
+}
+
+
+void CloudEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "speed", this, CloudEffect, setAnimationSpeed);
+    LoadParam(root, "scale", this, CloudEffect, setCloudScale);
+    LoadParam(root, "cloudcolor", this, CloudEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, CloudEffect, setSkyColor);
+
+    LoadParam(root, "planetRadius", this, CloudEffect, setPlanetRadius);
+    LoadParam(root, "atmosphericRadius", this, CloudEffect, setAtmosphericRadius);
+    LoadParam(root, "divisions", this, CloudEffect, setDivisions);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, CloudEffect, setCloudOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+void CloudEffect::activate() {
+    PRINTF(0)( "Activating\n");
+
+    // Can only be set after the loadParams call
+    this->shader->activateShader();
+    Shader::Uniform(shader, "Scale").set(this->scale);
+    this->skycolor->set
+    (skyColor.x, skyColor.y, skyColor.z);
+    this->cloudcolor->set
+    (cloudColor.x, cloudColor.y, cloudColor.z);
+    this->shader->deactivateShader();
+
+    this->skydome->generateSkyPlane(this->divs, this->planetRadius, this->atmosphericRadius, 1, 1);
+    this->skydome->activate();
+
+    this->cloudActivate = true;
+}
+
+void CloudEffect::deactivate() {
+    PRINTF(0)("Deactivating CloudEffect\n");
+
+    this->skydome->deactivate();
+    this->cloudActivate = false;
+}
+
+void CloudEffect::draw() const {}
+
+void CloudEffect::tick (float dt) {
+
+    if (this->cloudActivate) {
+
+        this->offsetZ += 0.05 * dt * this->animationSpeed;
+
+        this->shader->activateShader();
+        this->offset->set
+        (0.0f, 0.0f, offsetZ);
+
+        if(cloudColor != newCloudColor) {
+
+            if(fadeCloud) {
+
+                this->cloudColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudX);
+                this->cloudColorFadeX->setInfinity(ANIM_INF_CONSTANT);
+                this->cloudColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudY);
+                this->cloudColorFadeY->setInfinity(ANIM_INF_CONSTANT);
+                this->cloudColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorCloudZ);
+                this->cloudColorFadeZ->setInfinity(ANIM_INF_CONSTANT);
+
+                this->cloudColorFadeX->addKeyFrame(cloudColor.x, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeX->addKeyFrame(newCloudColor.x, 0, ANIM_LINEAR);
+
+                this->cloudColorFadeY->addKeyFrame(cloudColor.y, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeY->addKeyFrame(newCloudColor.y, 0, ANIM_LINEAR);
+
+                this->cloudColorFadeZ->addKeyFrame(cloudColor.z, fadeTime, ANIM_LINEAR);
+                this->cloudColorFadeZ->addKeyFrame(newCloudColor.z, 0, ANIM_LINEAR);
+
+                fadeCloud = false;
+
+                this->cloudColorFadeX->replay();
+                this->cloudColorFadeY->replay();
+                this->cloudColorFadeZ->replay();
+            }
+
+            this->cloudcolor->set
+            (this->cloudColor.x, this->cloudColor.y, this->cloudColor.z);
+        }
+
+        if(skyColor != newSkyColor) {
+
+            if(fadeSky) {
+
+                this->skyColorFadeX = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyX);
+                this->skyColorFadeX->setInfinity(ANIM_INF_CONSTANT);
+                this->skyColorFadeY = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyY);
+                this->skyColorFadeY->setInfinity(ANIM_INF_CONSTANT);
+                this->skyColorFadeZ = new tAnimation<CloudEffect>(this, &CloudEffect::setColorSkyZ);
+                this->skyColorFadeZ->setInfinity(ANIM_INF_CONSTANT);
+
+                this->skyColorFadeX->addKeyFrame(skyColor.x, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeX->addKeyFrame(newSkyColor.x, 0, ANIM_LINEAR);
+
+                this->skyColorFadeY->addKeyFrame(skyColor.y, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeY->addKeyFrame(newSkyColor.y, 0, ANIM_LINEAR);
+
+                this->skyColorFadeZ->addKeyFrame(skyColor.z, fadeTime, ANIM_LINEAR);
+                this->skyColorFadeZ->addKeyFrame(newSkyColor.z, 0, ANIM_LINEAR);
+
+                fadeSky = false;
+
+                this->skyColorFadeX->replay();
+                this->skyColorFadeY->replay();
+                this->skyColorFadeZ->replay();
+            }
+
+            this->skycolor->set
+            (this->skyColor.x, this->skyColor.y, this->skyColor.z);
+        }
+
+        this->shader->deactivateShader();
+    }
+}
+
+
+void CloudEffect::setColorSkyX(float color) {
+    skyColor.x = color;
+}
+void CloudEffect::setColorSkyY(float color) {
+    skyColor.y = color;
+}
+void CloudEffect::setColorSkyZ(float color) {
+    skyColor.z = color;
+}
+void CloudEffect::setColorCloudX(float color) {
+    cloudColor.x = color;
+}
+void CloudEffect::setColorCloudY(float color) {
+    cloudColor.y = color;
+}
+void CloudEffect::setColorCloudZ(float color) {
+    cloudColor.z = color;
+}
+
+void CloudEffect::changeSkyColor(Vector color, float time) {
+    newSkyColor = color;
+    fadeSky = true;
+    fadeTime = time;
+}
+
+
+void CloudEffect::changeCloudColor(Vector color, float time) {
+    newCloudColor = color;
+    fadeCloud = true;
+    fadeTime = time;
+}
+
+void CloudEffect::shellSkyColor(float colorX, float colorY, float colorZ, float time) {
+    changeSkyColor( Vector(colorX, colorY, colorZ), time);
+}
+
+void CloudEffect::shellCloudColor(float colorX, float colorY, float colorZ, float time) {
+    changeCloudColor( Vector(colorX, colorY, colorZ), time);
+}
+
+
+
+void CloudEffect::make3DNoiseTexture() {
+    int f, i, j, k, inc;
+    int startFrequency = 4;
+    int numOctaves = 4;
+    double ni[3];
+    double inci, incj, inck;
+    int frequency = startFrequency;
+    GLubyte *ptr;
+    double amp = 0.5;
+
+    if ((noise3DTexPtr = (GLubyte *) malloc(noise3DTexSize *
+                                            noise3DTexSize *
+                                            noise3DTexSize * 4)) == NULL)
+        PRINTF(0)("ERROR: Could not allocate 3D noise texture\n");
+
+    for (f=0, inc=0; f < numOctaves;
+            ++f, frequency *= 2, ++inc, amp *= 0.5) {
+        SetNoiseFrequency(frequency);
+        ptr = noise3DTexPtr;
+        ni[0] = ni[1] = ni[2] = 0;
+
+        inci = 1.0 / (noise3DTexSize / frequency);
+        for (i=0; i<noise3DTexSize; ++i, ni[0] += inci) {
+            incj = 1.0 / (noise3DTexSize / frequency);
+            for (j=0; j<noise3DTexSize; ++j, ni[1] += incj) {
+                inck = 1.0 / (noise3DTexSize / frequency);
+                for (k=0; k<noise3DTexSize; ++k, ni[2] += inck, ptr+= 4) {
+                    *(ptr+inc) = (GLubyte) (((noise3(ni)+1.0) * amp)*128.0);
+                }
+            }
+        }
+    }
+}
+
+void CloudEffect::initNoise() {
+    int i, j, k;
+
+    srand(30757);
+    for (i = 0 ; i < B ; i++) {
+        p[i] = i;
+        g1[i] = (double)((rand() % (B + B)) - B) / B;
+
+        for (j = 0 ; j < 2 ; j++)
+            g2[i][j] = (double)((rand() % (B + B)) - B) / B;
+        normalize2(g2[i]);
+
+        for (j = 0 ; j < 3 ; j++)
+            g3[i][j] = (double)((rand() % (B + B)) - B) / B;
+        normalize3(g3[i]);
+    }
+
+    while (--i) {
+        k = p[i];
+        p[i] = p[j = rand() % B];
+        p[j] = k;
+    }
+
+    for (i = 0 ; i < B + 2 ; i++) {
+        p[B + i] = p[i];
+        g1[B + i] = g1[i];
+        for (j = 0 ; j < 2 ; j++)
+            g2[B + i][j] = g2[i][j];
+        for (j = 0 ; j < 3 ; j++)
+            g3[B + i][j] = g3[i][j];
+    }
+}
+
+void CloudEffect::SetNoiseFrequency( int frequency) {
+    start = 1;
+    B = frequency;
+    BM = B-1;
+}
+
+double CloudEffect::noise3( double vec[3]) {
+    int bx0, bx1, by0, by1, bz0, bz1, b00, b10, b01, b11;
+    double rx0, rx1, ry0, ry1, rz0, rz1, *q, sy, sz, a, b, c, d, t, u, v;
+    int i, j;
+
+    if (start) {
+        start = 0;
+        initNoise();
+    }
+
+    setup(0, bx0,bx1, rx0,rx1);
+    setup(1, by0,by1, ry0,ry1);
+    setup(2, bz0,bz1, rz0,rz1);
+
+    i = p[ bx0 ];
+    j = p[ bx1 ];
+
+    b00 = p[ i + by0 ];
+    b10 = p[ j + by0 ];
+    b01 = p[ i + by1 ];
+    b11 = p[ j + by1 ];
+
+    t  = s_curve(rx0);
+    sy = s_curve(ry0);
+    sz = s_curve(rz0);
+
+    q = g3[ b00 + bz0 ] ;
+    u = at3(rx0,ry0,rz0);
+    q = g3[ b10 + bz0 ] ;
+    v = at3(rx1,ry0,rz0);
+    a = lerp(t, u, v);
+
+    q = g3[ b01 + bz0 ] ;
+    u = at3(rx0,ry1,rz0);
+    q = g3[ b11 + bz0 ] ;
+    v = at3(rx1,ry1,rz0);
+    b = lerp(t, u, v);
+
+    c = lerp(sy, a, b);
+
+    q = g3[ b00 + bz1 ] ;
+    u = at3(rx0,ry0,rz1);
+    q = g3[ b10 + bz1 ] ;
+    v = at3(rx1,ry0,rz1);
+    a = lerp(t, u, v);
+
+    q = g3[ b01 + bz1 ] ;
+    u = at3(rx0,ry1,rz1);
+    q = g3[ b11 + bz1 ] ;
+    v = at3(rx1,ry1,rz1);
+    b = lerp(t, u, v);
+
+    d = lerp(sy, a, b);
+
+    return lerp(sz, c, d);
+}
+
+void CloudEffect::normalize2( double v[2]) {
+    double s;
+
+    s = sqrt(v[0] * v[0] + v[1] * v[1]);
+    v[0] = v[0] / s;
+    v[1] = v[1] / s;
+}
+
+void CloudEffect::normalize3( double v[3]) {
+    double s;
+
+    s = sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]);
+    v[0] = v[0] / s;
+    v[1] = v[1] / s;
+    v[2] = v[2] / s;
+}
+
Index: /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/cloud_effect.h	(revision 9760)
@@ -0,0 +1,172 @@
+/**
+ * @file cloud_effect.h
+ * Create clouds
+*/
+
+#ifndef _CLOUD_EFFECT
+#define _CLOUD_EFFECT
+
+#include "weather_effect.h"
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+#include "skydome.h"
+#include "material.h"
+#include "shader.h"
+
+#define MAXB 0x100
+#define N 0x1000
+#define NP 12   /* 2^N */
+#define NM 0xfff
+
+#define s_curve(t) ( t * t * (3. - 2. * t) )
+#define lerp(t, a, b) ( a + t * (b - a) )
+#define setup(i,b0,b1,r0,r1)\
+        t = vec[i] + N;\
+        b0 = ((int)t) & BM;\
+        b1 = (b0+1) & BM;\
+        r0 = t - (int)t;\
+        r1 = r0 - 1.;
+#define at2(rx,ry) ( rx * q[0] + ry * q[1] )
+#define at3(rx,ry,rz) ( rx * q[0] + ry * q[1] + rz * q[2] )
+
+// FORWARD DECLARATION
+template <class T>
+class tAnimation;
+
+class CloudEffect : public WeatherEffect {
+  ObjectListDeclaration(CloudEffect);
+
+public:
+
+    CloudEffect(const TiXmlElement* root = NULL);
+    virtual ~CloudEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate();
+    virtual void deactivate();
+
+    void activateCloud() {
+        this->activate();
+    }
+    void deactivateCloud() {
+        this->deactivate();
+    }
+
+    void setCloudOption(const std::string& option) {
+        if (option == "activate")
+            this->cloudActivate = true;
+    }
+
+    void setAnimationSpeed(float speed) {
+        this->animationSpeed = speed;
+    }
+
+    void setCloudScale(float scale) {
+        this->scale = scale;
+    }
+
+    void setCloudColor(float colorX, float colorY, float colorZ) {
+        this->cloudColor = Vector(colorX, colorY, colorZ);
+    }
+
+    void setSkyColor(float colorX, float colorY, float colorZ) {
+        this->skyColor = Vector(colorX, colorY, colorZ);
+    }
+
+    void setPlanetRadius(float planetRadius) {
+        this->planetRadius = planetRadius;
+    }
+
+    void setAtmosphericRadius(float atmosphericRadius) {
+        this->atmosphericRadius = atmosphericRadius;
+    }
+
+    void setDivisions(int divs) {
+        this->divs = divs;
+    }
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    static void changeSkyColor(Vector color, float time);
+    static void changeCloudColor(Vector color, float time);
+
+    void setColorSkyX(float color);
+    void setColorSkyY(float color);
+    void setColorSkyZ(float color);
+    void setColorCloudX(float color);
+    void setColorCloudY(float color);
+    void setColorCloudZ(float color);
+
+    static Vector cloudColor;
+    static Vector skyColor;
+
+    void make3DNoiseTexture();
+    void initNoise();
+    void SetNoiseFrequency(int frequency);
+    double noise3(double vec[3]);
+    void normalize2(double v[2]);
+    void normalize3(double v[3]);
+
+    void generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius,
+                          float hTile, float vTile);
+
+    void shellSkyColor(float colorX, float colorY, float colorZ, float time);
+    void shellCloudColor(float colorX, float colorY, float colorZ, float time);
+
+
+private:
+
+    bool                    cloudActivate;
+    float                   animationSpeed;
+
+    static Vector           newSkyColor;
+    static Vector           newCloudColor;
+
+    // Material             cloudMaterial;
+    Skydome*                 skydome;
+
+    tAnimation<CloudEffect>*  skyColorFadeX;
+    tAnimation<CloudEffect>*  skyColorFadeY;
+    tAnimation<CloudEffect>*  skyColorFadeZ;
+    tAnimation<CloudEffect>*  cloudColorFadeX;
+    tAnimation<CloudEffect>*  cloudColorFadeY;
+    tAnimation<CloudEffect>*  cloudColorFadeZ;
+    static bool fadeSky;
+    static bool fadeCloud;
+    static float fadeTime;
+
+    // SHADER STUFF
+    Shader*          shader;
+    Shader::Uniform* offset;
+    Shader::Uniform* skycolor;
+    Shader::Uniform* cloudcolor;
+    float            offsetZ;
+    float            scale;
+    float            planetRadius;
+    float            atmosphericRadius;
+    int              divs;
+
+    // NOISE STUFF
+    int              noise3DTexSize;
+    GLuint           noise3DTexName;
+    GLubyte          *noise3DTexPtr;
+
+    int              p[MAXB + MAXB + 2];
+    double           g3[MAXB + MAXB + 2][3];
+    double           g2[MAXB + MAXB + 2][2];
+    double           g1[MAXB + MAXB + 2];
+
+    int              start;
+    int              B;
+    int              BM;
+
+
+};
+
+#endif  /* _CLOUD_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/fog_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/fog_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/fog_effect.cc	(revision 9760)
@@ -0,0 +1,263 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#include "fog_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "shell_command.h"
+#include "script_class.h"
+#include "cloud_effect.h"
+#include "debug.h"
+
+ObjectListDefinition(FogEffect);
+// Define shell commands
+//SHELL_COMMAND(activate, FogEffect, activateFog);
+//SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
+SHELL_COMMAND(fadein, FogEffect, fadeInFog);
+SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
+
+#include "class_id_DEPRECATED.h"
+
+CREATE_SCRIPTABLE_CLASS(FogEffect,
+                        addMethod("fadeIn", Executor0<FogEffect, lua_State*>(&FogEffect::fadeInFog))
+                            ->addMethod("fadeOut", Executor0<FogEffect, lua_State*>(&FogEffect::fadeOutFog))
+                            ->addMethod("activate", Executor0<FogEffect, lua_State*>(&FogEffect::activate))
+                            ->addMethod("deactivate", Executor0<FogEffect, lua_State*>(&FogEffect::deactivate))
+                       );
+
+CREATE_FACTORY(FogEffect);
+
+/**
+ * @brief standard constructor
+ */
+FogEffect::FogEffect(const TiXmlElement* root) {
+  this->registerObject(this, FogEffect::_objectList);
+    // Initialize values
+    this->init();
+
+    // Load XML params
+    if (root != NULL)
+        this->loadParams(root);
+
+    // Activate fog, if chosen to be activated by default
+    if (this->fogActivate)
+        this->activate();
+}
+
+/**
+ * @brief standard destructor
+ */
+FogEffect::~FogEffect() {
+    this->deactivate();
+}
+
+/**
+ * @brief initalizes the fog effect with default values
+ */
+void FogEffect::init() {
+    // default values
+  this->fogMode = GL_LINEAR;
+  this->fogDensity = 0.005;
+  this->fogStart = 0;
+  this->fogEnd = 300;
+  this->colorVector = Vector(0.6, 0.0, 0.0);
+
+    // init variables
+  this->fogFadeInDuration = 0;
+  this->fogFadeOutDuration = 0;
+  this->fogFadeDensity = 0;
+  this->fogFadeEnd = 0;
+
+  this->localTimer = 0;
+  this->fogActivate = false;
+  this->fogFadeInActivate = false;
+  this->fogFadeOutActivate = false;
+
+  this->cloudColor = Vector(0.2f, 0.3f, 0.3f);
+  this->skyColor = Vector(0.2f, 0.3f, 0.3f);
+}
+
+/**
+ * @brief loads the fog effect parameters.
+ * @param root: the XML-Element to load the data from
+ */
+void FogEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");
+    LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");
+    LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");
+    LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");
+    LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");
+    LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");
+    LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, FogEffect, setSkyColor);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+      LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+/**
+ * @brief activates the fog effect
+ */
+void FogEffect::activate() {
+    PRINTF(3)( "Activating FogEffect\n");
+
+    // init fogGL
+    GLfloat fogColor[4] = { colorVector.x, colorVector.y, colorVector.z, 1.0};
+    glFogi(GL_FOG_MODE, this->fogMode);
+    glFogfv(GL_FOG_COLOR, fogColor);
+    glHint(GL_FOG_HINT, GL_DONT_CARE);
+    glFogf(GL_FOG_DENSITY, this->fogDensity);
+    glFogf(GL_FOG_START, this->fogStart);
+    glFogf(GL_FOG_END, this->fogEnd);
+
+    this->fogActivate = true;
+
+    glEnable(GL_FOG);
+
+    // Store cloud- and sky color before the snow
+    this->oldCloudColor = CloudEffect::cloudColor;
+    this->oldSkyColor   = CloudEffect::skyColor;
+
+    // Change the colors
+    CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration);
+    CloudEffect::changeSkyColor(this->skyColor, this->fogFadeInDuration);
+}
+
+/**
+ * @brief deactivates the fog effect
+ */
+void FogEffect::deactivate() {
+    PRINTF(3)("Deactivating FogEffect\n");
+
+    this->fogFadeInActivate = false;
+    this->fogFadeOutActivate = false;
+    this->fogActivate = false;
+
+    glDisable(GL_FOG);
+}
+
+/**
+ * @brief draws the fog effect
+ */
+void FogEffect::draw() const {
+
+    if (!this->fogActivate)
+        return;
+
+    // If fog is fading
+    if ( this->fogFadeInActivate || this->fogFadeOutActivate ) {
+        if ( this->fogMode == GL_LINEAR)
+            glFogf(GL_FOG_END, this->fogFadeEnd);
+        else
+            glFogf(GL_FOG_DENSITY, this->fogFadeDensity);
+    }
+}
+
+/**
+ * @brief ticks the fog effect
+ * @param dt: tick float
+ */
+void FogEffect::tick(float dt) {
+
+    if (!this->fogActivate)
+        return;
+
+    // If fog is fading in
+    if ( this->fogFadeInActivate ) {
+        this->localTimer += dt;
+
+        if ( this->fogMode == GL_LINEAR)
+          this->fogFadeEnd = 2000 * (1 - ( this->localTimer / this->fogFadeInDuration )) + this->fogEnd;
+        else
+            this->fogFadeDensity = ( this->localTimer / this->fogFadeInDuration ) * this->fogDensity;
+
+        if ( this->localTimer >= this->fogFadeInDuration )
+            this->fogFadeInActivate = false;
+    }
+
+    // If fog is fading out
+    if ( this->fogFadeOutActivate ) {
+        this->localTimer += dt;
+
+        if ( this->fogMode == GL_LINEAR)
+          this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeOutDuration ) + this->fogEnd;
+        else
+            this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeOutDuration ) * this->fogDensity);
+
+        if ( this->localTimer >= this->fogFadeOutDuration )
+            this->deactivate();
+    }
+}
+
+/**
+ * @brief fades the fog in
+ */
+void FogEffect::fadeInFog() {
+
+    // If Fog is already fading out, stop it
+    this->fogFadeOutActivate = false;
+
+    // If Fog is already on, turn it off first
+    if (this->fogActivate)
+        this->deactivate();
+
+    // If no manual FadeIn value was set, set a default value
+    if (!this->fogFadeInDuration > 0)
+        this->fogFadeInDuration = 10;
+
+    // Reset local timer
+    this->localTimer = 0;
+
+    // Activate Fog
+    this->activate();
+
+    // set FogFadeIn activate
+    this->fogFadeInActivate = true;
+}
+
+/**
+ * @brief fades the fog out
+ */
+void FogEffect::fadeOutFog() {
+
+    // If Fog is already fading in, stop it
+    this->fogFadeInActivate = false;
+
+
+    // If Fog is off, turn it on first
+    if (!this->fogActivate)
+        this->activate();
+
+    // If no manual FadeOut value was set, set a default value
+    if (!this->fogFadeOutDuration > 0)
+        this->fogFadeOutDuration = 10;
+
+    // set FogFadeOut activate
+    this->fogFadeOutActivate = true;
+
+    // Reset local timer
+    this->localTimer = 0;
+
+    // Restore the old cloud- and sky color
+    CloudEffect::changeCloudColor(this->oldCloudColor, this->fogFadeOutDuration);
+    CloudEffect::changeSkyColor(this->oldSkyColor, this->fogFadeOutDuration);
+}
+
Index: /branches/new_class_id/src/world_entities/weather_effects/fog_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/fog_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/fog_effect.h	(revision 9760)
@@ -0,0 +1,130 @@
+/**
+ * @file fog_effect.h
+ * Generates simple openGL fog
+*/
+
+#ifndef _FOG_EFFECT
+#define _FOG_EFFECT
+
+#include "weather_effect.h"
+#include "glincl.h"
+#include "vector.h"
+
+class CloudEffect;
+
+class FogEffect : public WeatherEffect
+{
+  ObjectListDeclaration(FogEffect);
+public:
+  FogEffect(const TiXmlElement* root = NULL);
+  virtual ~FogEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  void activateFog()
+  {
+    this->activate();
+  }
+
+  void deactivateFog()
+  {
+    this->deactivate();
+  }
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+  inline void setFogMode(const std::string& mode)
+  {
+    this->fogMode = this->stringToFogMode(mode);
+  }
+
+  inline void setFogDensity(float density)
+  {
+    this->fogDensity = density;
+  }
+
+  inline void setFogRange(float start, float end)
+  {
+    this->fogStart = start;
+    this->fogEnd = end;
+  }
+
+  inline void setFogColor(float r, float g, float b)
+  {
+    this->colorVector = Vector(r, g, b);
+  }
+
+  inline void setFogFadeIn(float fadein)
+  {
+    this->fogFadeInDuration = fadein;
+  }
+
+  inline void setFogFadeOut(float fadeout)
+  {
+    this->fogFadeOutDuration = fadeout;
+  }
+
+  inline void setFogOption(const std::string& option)
+  {
+    if (option == "activate")
+      this->fogActivate = true;
+  }
+
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+
+  void fadeInFog();
+  void fadeOutFog();
+
+
+private:
+  inline GLint stringToFogMode(const std::string& mode)
+  {
+    if(mode == "GL_LINEAR")
+      return GL_LINEAR;
+    else if(mode == "GL_EXP")
+      return GL_EXP;
+    else if(mode == "GL_EXP2" )
+      return GL_EXP2;
+    else
+      return -1;
+  }
+
+  bool          fogActivate;
+
+  bool          fogFadeInActivate;
+  bool          fogFadeOutActivate;
+
+  GLfloat       fogFadeInDuration;
+  GLfloat       fogFadeOutDuration;
+
+  GLint         fogMode;
+  GLfloat       fogDensity;
+  GLfloat       fogFadeDensity;
+
+  GLfloat       fogStart;
+  GLfloat       fogEnd;
+  GLfloat       fogFadeEnd;
+
+  Vector        colorVector;
+  float         localTimer;
+
+  Vector oldSkyColor;
+  Vector oldCloudColor;
+  Vector skyColor;
+  Vector cloudColor;
+};
+
+#endif  /* _FOG_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.cc	(revision 9760)
@@ -0,0 +1,69 @@
+
+
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+
+#include "graphics_effect.h"
+
+#include "util/loading/load_param.h"
+
+ObjectListDefinition(GraphicsEffect);
+
+/**
+ * @param root The XML-element to load the GraphicsEffect from
+
+  @todo what to do, if no GraphicsEffect-Slots are open anymore ???
+ */
+GraphicsEffect::GraphicsEffect(const TiXmlElement* root) {
+  this->registerObject(this, GraphicsEffect::_objectList);
+    this->bActivated = false;
+}
+
+
+/**
+ *  destroys a GraphicsEffect
+ */
+GraphicsEffect::~GraphicsEffect() {
+}
+
+
+/**
+ * @param root The XML-element to load the GraphicsEffect from
+ */
+void GraphicsEffect::loadParams(const TiXmlElement* root) {
+    BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void GraphicsEffect::init() {}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void GraphicsEffect::draw() const {}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void GraphicsEffect::tick(float dt) {}
Index: /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/graphics_effect.h	(revision 9760)
@@ -0,0 +1,40 @@
+/**
+ * @file graphics_effect.h
+ *  abstract type of graphical effects
+ */
+
+#ifndef _GRAPHICS_EFFECT
+#define _GRAPHICS_EFFECT
+
+#include "base_object.h"
+
+class TiXmlElement;
+
+//! A class that handles GraphicsEffects. The GraphicsEffectManager operates on this.
+class GraphicsEffect : public BaseObject {
+  ObjectListDeclaration(GraphicsEffect);
+  public:
+    GraphicsEffect(const TiXmlElement* root = NULL);
+    virtual ~GraphicsEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline bool isActivated() const {
+        return this->bActivated;
+    }
+
+
+protected:
+    bool              bActivated;
+};
+
+
+#endif /* _GRAPHICS_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/lense_flare.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/lense_flare.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/lense_flare.cc	(revision 9760)
@@ -0,0 +1,230 @@
+
+
+/*
+   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: Patrick Boenzli
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "lense_flare.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "glincl.h"
+#include "texture.h"
+
+#include "light.h"
+#include "state.h"
+#include "debug.h"
+
+#include "render2D/image_plane.h"
+
+#include "light.h"
+#include "camera.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(LenseFlare, CL_LENSE_FLARE);
+CREATE_FACTORY(LenseFlare);
+
+/**
+ * @brief default constructor
+ * @param root The XML-element to load the LenseFlare from
+ */
+LenseFlare::LenseFlare(const TiXmlElement* root) {
+  this->registerObject(this, LenseFlare::_objectList);
+
+    /*          length                      image scale */
+    this->flareMatrix[0] = 1.0f;
+    this->flareMatrix[1] = 1.0f;
+    this->flareMatrix[2] = 0.5f;
+    this->flareMatrix[3] = 0.5f;
+    this->flareMatrix[4] = 0.33f;
+    this->flareMatrix[5] = 0.25f;
+    this->flareMatrix[6] = 0.125f;
+    this->flareMatrix[7] = 1.0f;
+    this->flareMatrix[8] = -0.5f;
+    this->flareMatrix[9] = 0.5f;
+    this->flareMatrix[10] = -0.25f;
+    this->flareMatrix[11] = 0.15f;
+    this->flareMatrix[12] = -1.82f;
+    this->flareMatrix[13] = 0.25f;
+
+    this->lightSource = (LightManager::getInstance())->getLight(0);
+    PRINTF(4)("light is: %p\n", this->lightSource);
+
+    if (root != NULL) {
+        this->loadParams(root);
+        this->activate();
+    }
+
+    this->bVisible = true;
+    this->setSourceVisibility(false);
+
+}
+
+
+/**
+ *  destroys a LenseFlare
+ */
+LenseFlare::~LenseFlare() {
+    std::vector<ImagePlane*>::iterator it;
+    for( it = flares.begin(); it != flares.end(); it++)
+        delete (*it);
+}
+
+
+/**
+ * @param root The XML-element to load the LenseFlare from
+ */
+void LenseFlare::loadParams(const TiXmlElement* root) {
+    GraphicsEffect::loadParams(root);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "add-flare-texture", this, LenseFlare, addFlare)
+        .describe("adds a lensflare texture to the engine");
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+/**
+ * initializes the fog effect
+ */
+void LenseFlare::init() {}
+
+
+/**
+ * activates the fog effect
+ */
+void LenseFlare::activate() {
+    this->bActivated = true;
+}
+
+
+/**
+ * deactivates the fog effect
+ */
+void LenseFlare::deactivate() {
+    this->bActivated = false;
+}
+
+
+/**
+ * @brief converts a gl mode char to a GLint
+ * @param mode the mode character
+ */
+GLint LenseFlare::stringToFogMode(const std::string& mode) {
+    return 0;
+}
+
+
+/**
+ * @brief adds a texture flare
+ * @param textureName the name of the flare texture
+ *
+ *  1st: Texture of the Sun/Light source itself
+ *  2nd: Texture of the fist halo
+ *  3rd: Texture of small burst
+ *  4th: Texture of the second halo
+ *  5th: Texutre of the second burst
+ *  6th: Texture of the third halo
+ *  7th: Texture of the third burst
+ */
+void LenseFlare::addFlare(const std::string& textureName) {
+    if( this->flares.size() > LF_MAX_FLARES) {
+        PRINTF(2)("You tried to add more than %i lense flares, ignoring\n", LF_MAX_FLARES);
+        return;
+    }
+
+    ImagePlane* bb = new ImagePlane(NULL);
+    if (this->flares.empty())
+        bb->setLayer(E2D_LAYER_BELOW_ALL);
+    bb->setTexture(textureName);
+    bb->setSize(50, 50);
+    this->flares.push_back(bb);
+    bb->setVisibility(true);
+
+    PRINTF(4)("Added a Lenseflare ImagePlane with texture %s\n", textureName.c_str());
+
+    // the first flare belongs to the light source
+    if( this->flares.size() == 1 && this->lightSource != NULL) {
+        bb->setBindNode(static_cast<PNode*>(this->lightSource));
+    }
+
+    PRINTF(4)("Finished adding\n");
+}
+
+
+void LenseFlare::setSourceVisibility(bool visibility) {
+    if (this->bVisible == visibility)
+        return;
+
+    std::vector<ImagePlane*>::const_iterator it;
+    for(it = ++flares.begin(); it != flares.end(); it++)
+        (*it)->setVisibility(visibility);
+    this->bVisible = visibility;
+}
+
+
+/**
+ * tick the effect
+ */
+void LenseFlare::tick(float dt) {
+    if( unlikely(!this->bActivated || this->flares.size() == 0))
+        return;
+
+    // refetch light source information if needed
+    if( unlikely( this->lightSource == NULL)) {
+        this->lightSource = (LightManager::getInstance())->getLight(0);
+        if( this->flares.size() > 0)
+            this->flares[0]->setBindNode(static_cast<PNode*>(this->lightSource));
+    }
+
+    //set the frustum plane
+    if (!flares.empty())
+        this->setSourceVisibility(this->flares[0]->isVisible());
+
+
+    // always update the screen center, it could be, that the window is resized
+    this->screenCenter = Vector2D(State::getResX()/2.0f, State::getResY()/2.0f);
+
+    // flare vector is the direction from the center to the light source
+    this->flareVector = this->flares[0]->getAbsCoor2D() - this->screenCenter;
+    this->distance = this->flareVector.len();
+    this->flareVector.normalize();
+
+    // now calculate the new coordinates of the billboards
+    std::vector<ImagePlane*>::iterator it;
+    int i;
+    for( it = flares.begin(), i = 0; it != flares.end(); it++, i++) {
+        // set the new position
+        if( i == 0)
+            continue;
+
+        (*it)->setAbsCoor2D( this->screenCenter + this->flareVector * this->flareMatrix[i * 2] * this->distance);
+        (*it)->setSize2D(50.0f * this->flareMatrix[i * 2 + 1], 50.0f * this->flareMatrix[i * 2 + 1]);
+        PRINTF(5)("Tick flare %i @ (%f, %f)\n", i, (*it)->getAbsCoor2D().x, (*it)->getAbsCoor2D().y);
+    }
+}
+
+
+/**
+ * draws the LenseFlares
+ */
+void LenseFlare::draw() const {
+    if( !this->bActivated)
+        return;
+}
Index: /branches/new_class_id/src/world_entities/weather_effects/lense_flare.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/lense_flare.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/lense_flare.h	(revision 9760)
@@ -0,0 +1,65 @@
+/**
+ * @file lense_flare.h
+ *  lense flare effect
+ */
+
+#ifndef _LENSE_FLARE
+#define _LENSE_FLARE
+
+#include "graphics_effect.h"
+
+#include <vector>
+
+#include "vector2D.h"
+#include "plane.h"
+#include "glincl.h"
+
+
+#define LF_MAX_FLARES 7
+
+
+class TiXmlElement;
+class Light;
+class ImagePlane;
+
+//! A class that handles LenseFlares. The LenseFlareManager operates on this.
+class LenseFlare : public GraphicsEffect
+{
+  ObjectListDeclaration(LenseFlare);
+  public:
+    LenseFlare(const TiXmlElement* root = NULL);
+    virtual ~LenseFlare();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    void addFlare(const std::string& textureName);
+
+
+  private:
+    GLint stringToFogMode(const std::string& mode);
+    void setSourceVisibility(bool visibility) ;
+
+
+  private:
+    bool                     bVisible;          //!< Checks visibility
+    Light*                   lightSource;        //!< reference to the sun (or primary light source)
+    std::vector<ImagePlane*> flares;             //!< the flares array
+
+    Vector2D                 flareVector;        //!< the axis to draw the flares on
+    float                    distance;           //!< distance from center to source
+    Vector2D                 screenCenter;       //!< the vector marking the center of the screen
+
+    float                    flareMatrix[14];
+    Plane                    frustumPlane;       //!< plane that marks the view frustum
+};
+
+
+#endif /* _LENSE_FLARE */
Index: /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.cc	(revision 9760)
@@ -0,0 +1,288 @@
+/*
+   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: hdavid, amaechler
+*/
+
+#include "lightning_effect.h"
+
+#include "state.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/resource_manager.h"
+
+#include "effects/billboard.h"
+
+#include "shell_command.h"
+#include "light.h"
+#include "cloud_effect.h"
+#include "script_class.h"
+#include "debug.h"
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(LightningEffect, CL_LIGHTNING_EFFECT);
+
+SHELL_COMMAND(activate, LightningEffect, activateLightning);
+SHELL_COMMAND(deactivate, LightningEffect, deactivateLightning);
+
+CREATE_SCRIPTABLE_CLASS(LightningEffect,
+                        addMethod("activate", Executor0<LightningEffect, lua_State*>(&LightningEffect::activate))
+                            ->addMethod("deactivate", Executor0<LightningEffect, lua_State*>(&LightningEffect::deactivate))
+                       );
+
+CREATE_FACTORY(LightningEffect);
+
+LightningEffect::LightningEffect(const TiXmlElement* root) {
+  this->registerObject(this, LightningEffect::_objectList);
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    if(this->lightningActivate)
+        this->activate();
+}
+
+LightningEffect::~LightningEffect() {
+    this->deactivate();
+}
+
+void LightningEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "coord", this, LightningEffect, coord);
+    LoadParam(root, "frequency", this, LightningEffect, setFlashFrequency);
+    LoadParam(root, "const-time", this, LightningEffect, setFlashConstTime);
+    LoadParam(root, "rising-time", this, LightningEffect, setFlashRisingTime);
+    LoadParam(root, "size", this, LightningEffect, setFlashSize);
+    LoadParam(root, "seed", this, LightningEffect, setFlashSeed);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, LightningEffect, setLightningOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+
+void LightningEffect::init() {
+    //default values
+    this->lightningActivate = false;
+
+    this->flashFrequency = 4.0f;
+    this->flashFrequencyBase = 4.0f;
+    this->flashFrequencySeed = 2.0f;
+
+    this->flashHoldTime = 0.1f;
+    this->flashRisingTime = 0.03f;
+
+    this->seedX = 500.f;
+    this->seedZ = 1000.0f;
+
+    this->width = 640.0f;
+    this->height = 400.0f;
+    this->seedWidth = 100.0f;
+    this->seedHeight = 100.0f;
+
+    this->lightningMove = false;
+
+    this->mainPosX = 0;
+    this->mainPosY = 100;
+    this->mainPosZ = 5;
+
+    this->time = 0.0;
+
+    // initialize thunder billboard
+    int i;
+    for (i = 0; i < 4; i++) {
+        this->thunderBolt[i] = new Billboard(NULL);
+        this->thunderBolt[i]->setSize(this->width, this->height);
+        this->thunderBolt[i]->setVisibiliy(false);
+    }
+
+    //should load both texture
+    this->thunderTextureA = true;
+    this->setTexture();
+    this->switchTexture();
+
+    if (this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        for (i = 0; i < 4; i++)
+          this->thunderBolt[i]->setAbsCoor(this->cameraCoor.x + this->mainPosX, this->mainPosY, this->cameraCoor.z + this->mainPosZ);
+    } else
+        for (i = 0; i < 4; i++)
+          this->thunderBolt[i]->setAbsCoor(this->mainPosX, this->mainPosY, this->mainPosZ);
+
+    this->flashLight = new Light();
+    this->flashLight->setDiffuseColor(0,0,0);
+    this->flashLight->setSpecularColor(0,0,0);
+
+    //load sound
+    this->thunderBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/thunder.wav", WAV);
+
+}
+
+void LightningEffect::coord(float x, float y, float z) {
+    int i;
+
+    if (this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        for (i = 0; i < 4; i++)
+            this->thunderBolt[i]->setAbsCoor(this->cameraCoor.x+x, y, this->cameraCoor.z+z);
+    } else
+        for (i = 0; i < 4; i++)
+            this->thunderBolt[i]->setAbsCoor(x, y, z);
+
+    this->mainPosX = x;
+    this->mainPosY = y;
+    this->mainPosZ = z;
+}
+
+
+void LightningEffect::setFlashSize(float width, float height, float seedWidth, float seedHeight) {
+    this->width = width;
+    this->height = height;
+    this->seedWidth = seedWidth;
+    this->seedHeight = seedHeight;
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setSize(this->width, this->height);
+
+}
+
+
+void LightningEffect::activate() {
+    PRINTF(3)( "Activating LightningEffect\n" );
+    this->lightningActivate = true;
+
+    this->time = 0;
+}
+
+
+void LightningEffect::deactivate() {
+    PRINTF(3)("Deactivating LightningEffect\n");
+    this->lightningActivate = false;
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setVisibiliy(false);
+
+}
+
+void LightningEffect::tick (float dt) {
+    if(!lightningActivate)
+        return;
+
+    this->time += dt;
+
+    float x;
+    x = (float)rand()/(float)RAND_MAX;
+
+    if( this->time > this->flashFrequency) {
+        // Reset timer
+        this->time = 0.0f;
+
+        // Move thunderBolt to start position
+        this->flashLight->setAbsCoor(this->thunderBolt[0]->getAbsCoor().x, this->thunderBolt[0]->getAbsCoor().y, this->thunderBolt[0]->getAbsCoor().z);
+
+        // Start a flash & lightning cycle
+        this->thunderBolt[0]->setVisibiliy(true);
+
+        // Lighten up environment
+        this->flashLight->setDiffuseColor(1,1,1);
+        this->flashLight->setSpecularColor(1,1,1);
+
+
+        // Play thunder sound
+        this->soundSource.play(this->thunderBuffer);
+    }
+
+    if( this->thunderBolt[0]->isVisible() && this->time > this->flashRisingTime*1/3 ) {
+        this->thunderBolt[0]->setVisibiliy(false);
+        this->thunderBolt[1]->setVisibiliy(true);
+    } else if( this->thunderBolt[1]->isVisible() && this->time > this->flashRisingTime*2/3 ) {
+        this->thunderBolt[1]->setVisibiliy(false);
+        this->thunderBolt[2]->setVisibiliy(true);
+
+    } else if( this->thunderBolt[2]->isVisible() && this->time > this->flashRisingTime) {
+        this->thunderBolt[2]->setVisibiliy(false);
+        this->thunderBolt[3]->setVisibiliy(true);
+    }
+
+    if( this->thunderBolt[3]->isVisible() && this->time > this->flashHoldTime) {
+        this->thunderBolt[3]->setVisibiliy(false);
+
+        this->time = 0.0f;
+        this->flashLight->setDiffuseColor(0,0,0);
+        this->flashLight->setSpecularColor(0,0,0);
+
+        this->newCoordinates();
+    }
+}
+
+void LightningEffect::newCoordinates() {
+
+    float posX, posZ;
+
+    if(this->lightningMove) {
+        this->cameraCoor = State::getCameraNode()->getAbsCoor();
+        posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX + this->cameraCoor.x;
+        posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX + this->cameraCoor.z;
+    } else {
+        posX = this->mainPosX - this->seedX * (float)rand()/(float)RAND_MAX;
+        posZ = this->mainPosZ + this->seedZ * (float)rand()/(float)RAND_MAX;
+    }
+
+    this->switchTexture();
+
+    int i;
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setAbsCoor(posX, this->mainPosY, posZ);
+
+    this->flashFrequency = this->flashFrequencyBase + this->flashFrequencySeed * (float)rand()/(float)RAND_MAX;
+
+    float w = this->width + this->seedWidth * (float)rand()/(float)RAND_MAX;
+    float h = this->height + this->seedHeight * (float)rand()/(float)RAND_MAX;
+
+    for (i = 0; i < 4; i++)
+        this->thunderBolt[i]->setSize(w, h);
+
+}
+
+void LightningEffect::setTexture() {
+
+  if (this->thunderTextureA) {
+    this->thunderBolt[0]->setTexture("maps/thunderbA1.png");
+    this->thunderBolt[1]->setTexture("maps/thunderbA2.png");
+    this->thunderBolt[2]->setTexture("maps/thunderbA3.png");
+    this->thunderBolt[3]->setTexture("maps/thunderbA4.png");
+  }
+  else {
+    this->thunderBolt[0]->setTexture("maps/thunderbB1.png");
+    this->thunderBolt[1]->setTexture("maps/thunderbB2.png");
+    this->thunderBolt[2]->setTexture("maps/thunderbB3.png");
+    this->thunderBolt[3]->setTexture("maps/thunderbB4.png");
+  }
+
+}
+
+void LightningEffect::switchTexture() {
+
+  if (this->thunderTextureA)
+    this->thunderTextureA = false;
+  else
+    this->thunderTextureA = true;
+
+  this->setTexture();
+
+}
Index: /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/lightning_effect.h	(revision 9760)
@@ -0,0 +1,124 @@
+/**
+* @file lightning_effect.h
+*/
+
+#ifndef _LIGHTNING_EFFECT
+#define _LIGHTNING_EFFECT
+
+#include "vector.h"
+#include "vector2D.h"
+
+#include "weather_effect.h"
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+class Billboard;
+class Light;
+
+class LightningEffect : public WeatherEffect
+{
+  ObjectListDeclaration(LightningEffect);
+public:
+  LightningEffect(const TiXmlElement* root = NULL);
+  virtual ~LightningEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline  void activateLightning()
+  {
+    this->activate();
+  }
+  inline  void deactivateLightning()
+  {
+    this->deactivate();
+  }
+
+  virtual void tick(float dt);
+
+  void coord(float x, float y, float z);
+  void setFlashSize(float width, float height, float seedWidth, float seedHeight);
+
+  inline void setLightningOption(const std::string& option)
+  {
+    if (option == "activate")
+      this->lightningActivate = true;
+    if (option == "movelightning")
+      this->lightningMove = true;
+  }
+
+  inline void setFlashFrequency(float baseFrequency, float seedTime)
+  {
+    this->flashFrequencyBase = baseFrequency;
+    this->flashFrequency = baseFrequency;
+    this->flashFrequencySeed = seedTime;
+  }
+
+  inline void setFlashConstTime(float holdTime)
+  {
+    this->flashHoldTime = holdTime;
+  }
+
+  inline void setFlashRisingTime(float flashRisingTime)
+  {
+    if(flashRisingTime > this->flashHoldTime)
+      this->flashRisingTime = this->flashHoldTime * 0.5;
+    else
+      this->flashRisingTime = flashRisingTime;
+  }
+
+  inline void setFlashSeed(float seedX, float seedZ)
+  {
+    this->seedX = seedX;
+    this->seedZ = seedZ;
+  }
+
+
+private:
+
+  void newCoordinates();
+  void setTexture();
+  void switchTexture();
+
+  Billboard* thunderBolt[4];
+  bool thunderTextureA;
+
+  bool lightningActivate;
+  bool lightningMove;
+
+  float flashFrequency;
+  float flashFrequencyBase;
+  float flashHoldTime;
+  float flashRisingTime;
+
+  float time;
+
+  float width;
+  float height;
+  float seedWidth;
+  float seedHeight;
+
+  float seedX;
+  float seedZ;
+  float flashFrequencySeed;
+
+  float mainPosX;
+  float mainPosY;
+  float mainPosZ;
+
+  Vector origSkyColor;
+  Vector cameraCoor;
+
+  Light* flashLight;
+
+  OrxSound::SoundSource    soundSource;
+  OrxSound::SoundBuffer*   thunderBuffer;
+
+};
+
+#endif  /* _LIGHTNING_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/rain_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/rain_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/rain_effect.cc	(revision 9760)
@@ -0,0 +1,345 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GRAPHICS
+
+#include "rain_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/resource_manager.h"
+
+#include "glincl.h"
+#include "p_node.h"
+#include "state.h"
+#include "particles/spark_particles.h"
+#include "particles/plane_emitter.h"
+#include "shell_command.h"
+#include "light.h"
+#include "cloud_effect.h"
+#include "script_class.h"
+#include "debug.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(RainEffect, CL_RAIN_EFFECT);
+
+// Define shell commands
+//SHELL_COMMAND(activate, RainEffect, activateRain);
+//SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
+SHELL_COMMAND(startraining, RainEffect, startRaining);
+SHELL_COMMAND(stopraining, RainEffect, stopRaining);
+
+
+
+CREATE_SCRIPTABLE_CLASS(RainEffect,
+                        addMethod("startRaining", Executor0<RainEffect, lua_State*>(&RainEffect::startRaining))
+                            ->addMethod("stopRaining", Executor0<RainEffect, lua_State*>(&RainEffect::stopRaining))
+                            ->addMethod("activate", Executor0<RainEffect, lua_State*>(&RainEffect::activate))
+                            ->addMethod("deactivate", Executor0<RainEffect, lua_State*>(&RainEffect::deactivate))
+                       );
+
+CREATE_FACTORY(RainEffect);
+
+/**
+ * @brief standard constructor
+ */
+RainEffect::RainEffect(const TiXmlElement* root) {
+  this->registerObject(this, RainEffect::_objectList);
+    this->init();
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    //load rain sound
+    if (this->rainBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->rainBuffer);
+    this->rainBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/rain.wav", WAV);
+
+    //load wind sound
+    if (this->rainWindForce != 0) {
+        if (this->windBuffer != NULL)
+            ResourceManager::getInstance()->unload(this->windBuffer);
+        this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
+    }
+
+    if(rainActivate) {
+        this->activate();
+        RainEffect::rainParticles->precache((int)this->rainLife * 2);
+    }
+}
+
+/**
+ * @brief standard deconstructor
+ */
+RainEffect::~RainEffect() {
+    this->deactivate();
+
+    if (this->rainBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->rainBuffer);
+
+    if (this->windBuffer != NULL)
+        ResourceManager::getInstance()->unload(this->windBuffer);
+}
+
+/**
+ * @brief initalizes the rain effect with default values
+ */
+void RainEffect::init() {
+
+    this->rainParticles = NULL;
+    this->emitter = NULL;
+    this->rainBuffer = NULL;
+    this->windBuffer = NULL;
+    this->lightMan = NULL;
+
+    //Default values
+    this->rainActivate = false;
+    this->rainFadeInActivate = false;
+    this->rainFadeOutActivate = false;
+
+    this->rainMove = false;
+    this->rainCoord = Vector(500, 500, 500);
+    this->rainSize = Vector2D(1000, 1000);
+    this->rainRate = 4000;
+    this->rainVelocity = -300;
+    this->rainLife = 4;
+    this->rainWindForce  = 0;
+    this->rainFadeInDuration = 10;
+    this->rainFadeOutDuration = 10;
+
+    this->cloudColor = Vector(0.6f, 0.6f, 0.6f);
+    this->skyColor = Vector(0.0f, 0.0f, 0.0f);
+
+    this->rainMaxParticles = this->rainRate * this->rainLife;
+    this->localTimer = 0;
+    this->soundRainVolume = 0.3f;
+    this->emitter = new PlaneEmitter(this->rainSize);
+
+    lightMan = LightManager::getInstance();
+}
+
+/**
+ * @brief loads the rain effect parameters.
+ * @param root: the XML-Element to load the data from
+ */
+void RainEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+
+    LoadParam(root, "coord", this, RainEffect, setRainCoord);
+    LoadParam(root, "size", this, RainEffect, setRainSize);
+    LoadParam(root, "rate", this, RainEffect, setRainRate);
+    LoadParam(root, "velocity", this, RainEffect, setRainVelocity);
+    LoadParam(root, "life", this, RainEffect, setRainLife);
+    LoadParam(root, "wind", this, RainEffect, setRainWind);
+    LoadParam(root, "fadeinduration", this, RainEffect, setRainFadeIn);
+    LoadParam(root, "fadeoutduration", this, RainEffect, setRainFadeOut);
+    LoadParam(root, "cloudcolor", this, RainEffect, setCloudColor);
+    LoadParam(root, "skycolor", this, RainEffect, setSkyColor);
+
+    LOAD_PARAM_START_CYCLE(root, element);
+    {
+        LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption);
+    }
+    LOAD_PARAM_END_CYCLE(element);
+}
+
+SparkParticles* RainEffect::rainParticles = NULL;
+
+/**
+ * @brief activates the rain effect
+ */
+void RainEffect::activate() {
+    PRINTF(3)( "Activating RainEffect, coord: %f, %f, %f, size: %f, %f, rate: %f, velocity: %f, moveRain: %s\n", this->rainCoord.x, this->rainCoord.y, this->rainCoord.z, this->rainSize.x, this-> rainSize.y, this->rainRate, this->rainVelocity, this->rainMove ? "true" : "false" );
+
+    this->rainActivate = true;
+
+    if (unlikely(RainEffect::rainParticles == NULL)) {
+        RainEffect::rainParticles = new SparkParticles((int) this->rainMaxParticles);
+        RainEffect::rainParticles->setName("RainParticles");
+        RainEffect::rainParticles->setLifeSpan(this->rainLife, 2);
+        RainEffect::rainParticles->setRadius(0, 0.03);
+        RainEffect::rainParticles->setRadius(0.2, 0.02);
+        RainEffect::rainParticles->setRadius(1, 0.01);
+        RainEffect::rainParticles->setColor(0, 0.3, 0.3, 0.5, 0.2);   // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2); // grey blue 2
+        RainEffect::rainParticles->setColor(1, 0.7, 0.7, 0.7, 0.2);   // light grey
+    }
+
+    this->emitter->setSystem(RainEffect::rainParticles);
+    this->emitter->setRelCoor(this->rainCoord);
+    this->emitter->setEmissionRate(this->rainRate);
+    this->emitter->setEmissionVelocity(this->rainVelocity);
+    this->emitter->setSpread(this->rainWindForce / 50, 0.2);
+
+    // play rain sound and loop it
+    this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+
+    // if there's wind, play wind sound
+    if (this->rainWindForce > 0)
+        this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true);
+
+    // Store cloud- and sky color before the rain;
+    this->oldCloudColor = CloudEffect::cloudColor;
+    this->oldSkyColor   = CloudEffect::skyColor;
+
+    // If we're not fading, change color immediately
+    if (!this->rainFadeInActivate || !this->rainFadeOutActivate) {
+        CloudEffect::changeCloudColor(this->cloudColor, 0.2);
+        CloudEffect::changeSkyColor(this->skyColor, 0.2);
+    }
+
+    //lightMan->setAmbientColor(.1,.1,.1);
+}
+
+/**
+ * @brief deactivates the rain effect
+ */
+void RainEffect::deactivate() {
+    PRINTF(3)("Deactivating RainEffect\n");
+
+    this->rainActivate = false;
+    this->rainFadeInActivate = false;
+    this->rainFadeOutActivate = false;
+
+    //if(this->emitter)
+    //  this->emitter->setSystem(NULL);
+    //this->hideRain();
+
+    // Stop Sound
+    this->soundSource.stop();
+
+    // Restore the old cloud- and sky color
+    CloudEffect::changeCloudColor(this->oldCloudColor, 0.2);
+    CloudEffect::changeSkyColor(this->oldSkyColor, 0.2);
+}
+
+/**
+ * @brief ticks the rain effect
+ * @param dt: tick float
+ */
+void RainEffect::tick (float dt) {
+    if (!this->rainActivate)
+        return;
+
+    if (this->rainMove) {
+        this->rainCoord = State::getCameraNode()->getAbsCoor();
+        this->emitter->setRelCoor(this->rainCoord.x , this->rainCoord.y+800, this->rainCoord.z);
+    }
+
+    if (this->rainFadeInActivate) {
+        PRINTF(4)("tick fading IN RainEffect\n");
+
+        this->localTimer += dt;
+        float progress = this->localTimer / this->rainFadeInDuration;
+
+        // use alpha in color to fade in rain
+        RainEffect::rainParticles->setColor(0,   0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
+        RainEffect::rainParticles->setColor(1,   0.7, 0.7, 0.7, 0.2 * progress); // light grey
+
+        // increase radius for more "heavy" rain
+        RainEffect::rainParticles->setRadius(0, 0.03 * progress);
+        RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
+        RainEffect::rainParticles->setRadius(1, 0.01 * progress);
+
+        // increase sound volume
+        if (progress > 0.5) {
+          if (!this->soundSource.isPlaying())
+            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+          this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress * 2 - 0.5);
+        }
+
+        if (progress >= 1)
+            this->rainFadeInActivate = false;
+
+        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
+    }
+
+    if (this->rainFadeOutActivate) {
+        PRINTF(4)("tick fading OUT RainEffect\n");
+
+        this->localTimer += dt;
+        float progress = 1 - (this->localTimer / this->rainFadeOutDuration);
+
+        // use alpha in color to fade out
+        RainEffect::rainParticles->setColor(0,   0.3, 0.3, 0.5, 0.2 * progress); // grey blue 1
+        RainEffect::rainParticles->setColor(0.5, 0.4, 0.4, 0.5, 0.2 * progress); // grey blue 2
+        RainEffect::rainParticles->setColor(1,   0.7, 0.7, 0.7, 0.2 * progress); // light grey
+
+        // decrease radius
+        RainEffect::rainParticles->setRadius(0, 0.03 * progress);
+        RainEffect::rainParticles->setRadius(0.2, 0.02 * progress);
+        RainEffect::rainParticles->setRadius(1, 0.01 * progress);
+
+        // decrease sound volume
+        if (!this->soundSource.isPlaying())
+            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+        this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
+
+        if (progress <= 0) {
+            PRINTF(4)("tick fading OUT RainEffect COMPLETED! Deactivating...\n");
+            this->rainFadeOutActivate = false;
+            this->deactivate();
+        }
+        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
+    }
+}
+
+/**
+ * @brief starts raining slowly
+*/
+void RainEffect::startRaining() {
+    PRINTF(4)("startRaining function;\n");
+
+    // If it is already raining, do nothing
+    if (this->rainActivate)
+        return;
+
+    this->localTimer = 0;
+    this->rainFadeInActivate = true;
+
+    PRINTF(4)("startRaining function complete; fadedur: %f\n", this->rainFadeInDuration);
+    this->activate();
+
+    CloudEffect::changeCloudColor(this->cloudColor, this->rainFadeInDuration);
+    CloudEffect::changeSkyColor(this->skyColor, this->rainFadeInDuration);
+}
+
+/**
+ * @brief stops raining slowly
+ */
+void RainEffect::stopRaining() {
+    PRINTF(4)("stopRaining function;\n");
+
+    // If it is not raining, do nothing
+    if (!this->rainActivate)
+        return;
+
+    this->localTimer = 0;
+    this->rainFadeOutActivate = true;
+
+    PRINTF(4)("stopRaining function completed; fadedur: %f\n", this->rainFadeOutDuration);
+
+    CloudEffect::changeCloudColor(this->oldCloudColor, this->rainFadeOutDuration);
+    CloudEffect::changeSkyColor(this->oldSkyColor, this->rainFadeOutDuration);
+}
+
+/**
+ * @brief hides the rain
+ */
+void RainEffect::hideRain() {
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+    RainEffect::rainParticles->setColor(0, 0,0,0, 0);
+}
Index: /branches/new_class_id/src/world_entities/weather_effects/rain_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/rain_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/rain_effect.h	(revision 9760)
@@ -0,0 +1,144 @@
+/**
+ * @file rain_effect.h
+ * Generates rain using the particle engine
+*/
+
+#ifndef _RAIN_EFFECT
+#define _RAIN_EFFECT
+
+#include "weather_effect.h"
+
+#include "vector.h"
+#include "vector2D.h"
+#include <string>
+
+#include "particles/particle_system.h"
+
+class SparkParticles;
+class PlainEmitter;
+class LightManager;
+class CloudEffect;
+
+#include "sound_buffer.h"
+#include "sound_source.h"
+
+class RainEffect : public WeatherEffect
+{
+  ObjectListDeclaration(RainEffect);
+public:
+  RainEffect(const TiXmlElement* root = NULL);
+  virtual ~RainEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline void activateRain()
+  {
+    this->activate();
+  }
+
+  inline void deactivateRain()
+  {
+    this->deactivate();
+  }
+
+  virtual void tick(float dt);
+
+  void startRaining();
+  void stopRaining();
+
+  void hideRain();
+
+  inline void setRainCoord(float x, float y, float z)
+  {
+    this->rainCoord = Vector(x, y, z);
+  }
+  inline void setRainSize(float x, float y)
+  {
+    this->rainSize = Vector2D(x, y);
+  }
+  inline void setRainRate(float rate)
+  {
+    this->rainRate = rate;
+  }
+  inline void setRainVelocity(float velocity)
+  {
+    this->rainVelocity = -velocity;
+  }
+  inline void setRainLife(float life)
+  {
+    this->rainLife = life;
+  }
+  inline void setRainWind(int force)
+  {
+    this->rainWindForce = force;
+  }
+
+  inline void setRainFadeIn(float fadein)
+  {
+    this->rainFadeInDuration = fadein;
+  }
+  inline void setRainFadeOut(float fadeout)
+  {
+    this->rainFadeOutDuration = fadeout;
+  }
+
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+
+  inline void setRainOption(const std::string& option)
+  {
+    if (option == "moverain")
+      this->rainMove = true;
+    if (option == "activate")
+      this->rainActivate = true;
+  }
+
+
+private:
+  static SparkParticles*      rainParticles;
+  ParticleEmitter*            emitter;
+
+  float                       localTimer;
+
+  GLfloat                     rainFadeInDuration;
+  GLfloat                     rainFadeOutDuration;
+  bool                        rainFadeInActivate;
+  bool                        rainFadeOutActivate;
+
+  Vector                      rainCoord;
+  Vector2D                    rainSize;
+  GLfloat                     rainRate;
+  GLfloat                     rainVelocity;
+  GLfloat                     rainLife;
+  GLfloat                     rainMaxParticles;
+  int                         rainWindForce;
+  bool                        rainMove;
+  bool                        rainActivate;
+
+  OrxSound::SoundSource       soundSource;
+  OrxSound::SoundBuffer*      rainBuffer;
+  OrxSound::SoundBuffer*      windBuffer;
+
+  float                       soundRainVolume;
+
+  Vector                      oldSkyColor;
+  Vector                      oldCloudColor;
+  Vector                      skyColor;
+  Vector                      cloudColor;
+
+  LightManager*               lightMan;
+
+};
+
+#endif  /* _RAIN_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/snow_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/snow_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/snow_effect.cc	(revision 9760)
@@ -0,0 +1,234 @@
+/*
+        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: hdavid, amaechler
+*/
+
+#include "snow_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+#include "util/loading/resource_manager.h"
+
+#include "glincl.h"
+#include "debug.h"
+
+#include "p_node.h"
+#include "state.h"
+#include "particles/sprite_particles.h"
+#include "particles/plane_emitter.h"
+#include "shell_command.h"
+#include "script_class.h"
+#include "cloud_effect.h"
+
+#include "class_id_DEPRECATED.h"
+
+ObjectListDefinitionID(SnowEffect, CL_SNOW_EFFECT);
+SHELL_COMMAND(activate, SnowEffect, activateSnow);
+SHELL_COMMAND(deactivate, SnowEffect, deactivateSnow);
+
+
+CREATE_SCRIPTABLE_CLASS(SnowEffect,
+                            addMethod("activate", Executor0<SnowEffect, lua_State*>(&SnowEffect::activate))
+                            ->addMethod("deactivate", Executor0<SnowEffect, lua_State*>(&SnowEffect::deactivate))
+                       );
+
+CREATE_FACTORY(SnowEffect);
+
+SnowEffect::SnowEffect(const TiXmlElement* root)
+{
+  this->registerObject(this, SnowEffect::_objectList);
+
+        this->init();
+
+        if (root != NULL)
+                this->loadParams(root);
+
+        this->windBuffer = NULL;
+        //load wind sound
+        if (this->snowWindForce >= 1) {
+          this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
+        }
+
+  if(snowActivate) {
+                this->activate();
+    SnowEffect::snowParticles->precache((int) this->snowLife);
+  }
+}
+
+
+SnowEffect::~SnowEffect()
+{
+        this->deactivate();
+}
+
+SpriteParticles* SnowEffect::snowParticles = NULL;
+
+void SnowEffect::loadParams(const TiXmlElement* root)
+{
+        WeatherEffect::loadParams(root);
+
+        LoadParam(root, "numParticles", this, SnowEffect, numParticles);
+        LoadParam(root, "materialTexture", this, SnowEffect, materialTexture);
+        LoadParam(root, "lifeSpans", this, SnowEffect, lifeSpan);
+        LoadParam(root, "radius", this, SnowEffect, radius);
+        LoadParam(root, "mass", this, SnowEffect, mass);
+        LoadParam(root, "emissionRate", this, SnowEffect, emissionRate);
+        LoadParam(root, "emissionVelocity", this, SnowEffect, emissionVelocity);
+        LoadParam(root, "wind", this, SnowEffect, wind);
+        LoadParam(root, "size", this, SnowEffect, size);
+        LoadParam(root, "coord", this, SnowEffect, coord);
+  LoadParam(root, "cloudcolor", this, SnowEffect, setCloudColor);
+  LoadParam(root, "skycolor", this, SnowEffect, setSkyColor);
+  LoadParam(root, "fadetime", this, SnowEffect, setFadeTime);
+
+        LOAD_PARAM_START_CYCLE(root, element);
+        {
+                LoadParam_CYCLE(element, "option", this, SnowEffect, setSnowOption);
+        }
+        LOAD_PARAM_END_CYCLE(element);
+}
+
+void SnowEffect::init()
+{
+        this->emitter = new PlaneEmitter();
+
+        // Default values
+        this->snowActivate = false;
+        this->snowMove = false;
+        this->particles = 12000;
+        this->texture = "maps/snow_flake_01_32x32.png";
+        this->snowLife = 8;
+        this->randomLife = 2;
+        this->snowRadius = 3.5;
+        this->randomRadius = 1;
+        this->snowMass = 1.0;
+        this->randomMass = 0.3;
+        this->rate = 900;
+        this->velocity = -100;
+        this->randomVelocity = 5;
+        this->angle = 0.5;
+        this->randomAngle = 0.2;
+        this->alpha = 0.5;
+        this->snowSize = Vector2D(2500, 2500);
+        this->snowCoord = Vector(100,450,400);
+        this->snowWindForce = 1;
+
+  this->fadeTime = 10;
+  this->cloudColor = Vector(0.2f, 0.2f, 0.2f);
+  this->skyColor = Vector(0.0f, 0.0f, 0.0f);
+}
+
+void SnowEffect::activate()
+{
+        PRINTF(3)("Activating SnowEffect\n");
+
+        this->snowActivate = true;
+
+        SnowEffect::snowParticles = new SpriteParticles(particles);
+        SnowEffect::snowParticles->setName("SnowEffectTrailParticles");
+        SnowEffect::snowParticles->setMaterialTexture(texture);
+        SnowEffect::snowParticles->setLifeSpan(snowLife, randomLife);
+        SnowEffect::snowParticles->setRadius(0.0, snowRadius, randomRadius);
+        SnowEffect::snowParticles->setRadius(0.2, snowRadius, randomRadius*0.8);
+        SnowEffect::snowParticles->setRadius(1.0, snowRadius, randomRadius*0.5);
+        SnowEffect::snowParticles->setMass(0, snowMass, randomMass);
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+
+        this->emitter->setSystem(SnowEffect::snowParticles);
+
+        this->emitter->setRelCoor(snowCoord);
+        this->emitter->setEmissionRate(rate);
+        this->emitter->setEmissionVelocity(velocity, randomVelocity);
+        this->emitter->setSpread(angle * this->snowWindForce , randomAngle * this->snowWindForce);
+        this->emitter->setSize(snowSize);
+
+  if (this->snowWindForce != 0)
+    this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true);
+
+  // Store cloud- and sky color before the snow
+  this->oldCloudColor = CloudEffect::cloudColor;
+  this->oldSkyColor   = CloudEffect::skyColor;
+
+  // Change the colors
+  CloudEffect::changeCloudColor(this->cloudColor, this->fadeTime);
+  CloudEffect::changeSkyColor(this->skyColor, this->fadeTime);
+
+}
+
+
+void SnowEffect::deactivate()
+{
+        PRINTF(3)("Deactivating SnowEffect\n");
+
+        this->snowActivate = false;
+        this->emitter->setSystem(NULL);
+
+        if (this->windBuffer != NULL)
+                ResourceManager::getInstance()->unload(this->windBuffer);
+
+  // Restore the old cloud- and sky color
+  CloudEffect::changeCloudColor(this->oldCloudColor, this->fadeTime);
+  CloudEffect::changeSkyColor(this->oldSkyColor, this->fadeTime);
+}
+
+void SnowEffect::draw() const
+{
+        if (!this->snowActivate)
+                return;
+}
+
+void SnowEffect::tick(float dt)
+{
+        if (!this->snowActivate)
+                return;
+
+        /*
+        float distance = (State::getCameraNode()->getAbsCoor() - Vector(snowCoord.x, State::getCameraNode()->getAbsCoor().y, snowCoord.z)).len();
+
+        if(activated)
+        {
+        if(distance > 0.3*snowSize.x || distance > 0.3*snowSize.y)
+                        this->deactivate();
+        else if(distance > 0.25*snowSize.x || distance > 0.25*snowSize.y)
+        this->alpha = 0.15;
+        else if(distance > 0.2*snowSize.x || distance > 0.2*snowSize.y)
+        this->alpha = 0.25;
+        else if(distance > 0.1*snowSize.x || distance > 0.1*snowSize.y)
+        this->alpha = 0.4;
+
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+        }
+        else
+        {
+        if(distance < 0.3*snowSize.x || distance < 0.3*snowSize.y )
+        this->activate();
+        if( distance < 0.25*snowSize.x || distance < 0.25*snowSize.y )
+        this->alpha = 0.25;
+        else if( distance < 0.2*snowSize.x || distance < 0.2*snowSize.y )
+        this->alpha = 0.4;
+        else if( distance < 0.1*snowSize.x || distance < 0.1*snowSize.y )
+        this->alpha = 0.5;
+
+        SnowEffect::snowParticles->setColor(0,1, 1, 1, alpha);
+        SnowEffect::snowParticles->setColor(.5, .6, .6, .6, alpha/2);
+        SnowEffect::snowParticles->setColor(1, .0, .0, .0, .0);
+        }*/
+
+        if (this->snowMove) {
+                this->snowCoord = State::getCameraNode()->getAbsCoor();
+                this->emitter->setRelCoor(this->snowCoord.x , this->snowCoord.y+300, this->snowCoord.z);
+        }
+}
Index: /branches/new_class_id/src/world_entities/weather_effects/snow_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/snow_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/snow_effect.h	(revision 9760)
@@ -0,0 +1,148 @@
+/**
+* @file snow_effect.h
+*/
+
+#ifndef _SNOW_EFFECT
+#define _SNOW_EFFECT
+
+#include "vector.h"
+#include "particles/particle_system.h"
+#include "material.h"
+#include "vector2D.h"
+
+#include "weather_effect.h"
+
+class SpriteParticles;
+class PlaneEmitter;
+class PNode;
+class CloudEffect;
+
+#include "sound_source.h"
+#include "sound_buffer.h"
+
+class SnowEffect : public WeatherEffect
+{
+  ObjectListDeclaration(SnowEffect);
+public:
+  SnowEffect(const TiXmlElement* root = NULL);
+  virtual ~SnowEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  inline void activateSnow()
+  {
+    this->activate();
+  }
+  inline void deactivateSnow()
+  {
+    this->deactivate();
+  }
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+
+  inline void numParticles(int n)
+  {
+    this->particles = n;
+  }
+  inline void materialTexture(const std::string& texture)
+  {
+    this->texture = texture;
+  }
+  inline void lifeSpan(float lifeSpan, float randomLifeSpan)
+  {
+    this->snowLife = lifeSpan;
+    this->randomLife = randomLifeSpan;
+  }
+  inline void radius(float radius, float randomRadius)
+  {
+    this->snowRadius = radius;
+    this->randomRadius = randomRadius;
+  }
+  inline void mass(float mass, float randomMass)
+  {
+    this->snowMass = mass;
+    this->randomMass = randomMass;
+  }
+  inline void emissionRate(float emissionRate)
+  {
+    this->rate = emissionRate;
+  }
+  inline void emissionVelocity(float velocity, float randomVelocity)
+  {
+    this->velocity = velocity;
+    this->randomVelocity = randomVelocity;
+  }
+  inline void size(float sizeX, float sizeY)
+  {
+    this->snowSize = Vector2D(sizeX, sizeY);
+  }
+  inline void coord(float x, float y, float z)
+  {
+    this->snowCoord = Vector(x, y, z);
+  }
+  inline void wind(int force)
+  {
+    this->snowWindForce = force;
+  }
+  inline void setCloudColor(float colorX, float colorY, float colorZ)
+  {
+    this->cloudColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setSkyColor(float colorX, float colorY, float colorZ)
+  {
+    this->skyColor = Vector(colorX, colorY, colorZ);
+  }
+  inline void setFadeTime(float time)
+  {
+    this->fadeTime = time;
+  }
+
+  inline void setSnowOption(const std::string& option)
+  {
+    /*if (option == "fade") this->snowFade = true;*/
+    if (option == "movesnow")
+      this->snowMove = true;
+    if (option == "activate")
+      this->snowActivate = true;
+  }
+
+
+private:
+  int               particles;
+  std::string       texture;
+  float             snowLife, randomLife;
+  float             snowRadius, randomRadius;
+  float             snowMass, randomMass;
+  float             rate;
+  float             velocity, randomVelocity;
+  float             angle, randomAngle;
+  float             alpha;
+  float             fadeTime;
+  Vector            snowCoord;
+  Vector2D          snowSize;
+  int               snowWindForce;
+
+  bool              snowMove;
+  bool              snowActivate;
+
+  PlaneEmitter*     emitter;
+
+  static SpriteParticles*   snowParticles;
+  OrxSound::SoundSource     soundSource;
+  OrxSound::SoundBuffer*    windBuffer;
+
+  Vector            oldSkyColor;
+  Vector            oldCloudColor;
+  Vector            skyColor;
+  Vector            cloudColor;
+};
+
+
+#endif  /* _SNOW_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/sun_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/sun_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/sun_effect.cc	(revision 9760)
@@ -0,0 +1,76 @@
+
+
+/*
+   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: hdavid, amaechler
+*/
+
+
+#include "sun_effect.h"
+
+#include "util/loading/load_param.h"
+
+
+
+
+
+
+/**
+ * @param root The XML-element to load the SunEffect from
+ */
+SunEffect::SunEffect(const TiXmlElement* root)
+{
+//  this->setClassID(CL_SUN_EFFECT, "SunEffect");
+  this->bActivated = false;
+}
+
+
+/**
+ *  destroys a SunEffect
+ */
+SunEffect::~SunEffect()
+{
+
+}
+
+
+/**
+ * @param root The XML-element to load the SunEffect from
+ */
+void SunEffect::loadParams(const TiXmlElement* root)
+{
+  BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void SunEffect::init()
+{}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void SunEffect::draw() const
+{}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void SunEffect::tick(float dt)
+{}
+
Index: /branches/new_class_id/src/world_entities/weather_effects/sun_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/sun_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/sun_effect.h	(revision 9760)
@@ -0,0 +1,37 @@
+/*!
+ * @file sun_effect.h
+ *
+ */
+
+#ifndef _SUN_EFFECT_H
+#define _SUN_EFFECT_H
+
+#include "base_object.h"
+
+
+class TiXmlElement;
+
+class SunEffect : public BaseObject
+{
+  public:
+    SunEffect(const TiXmlElement* root = NULL);
+    virtual ~SunEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline bool isActivated() const { return this->bActivated; }
+
+  protected:
+    bool              bActivated;
+};
+
+
+#endif /* _SUN_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.cc	(revision 9760)
@@ -0,0 +1,198 @@
+/*
+  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: hdavid, amaechler
+*/
+
+#include "volfog_effect.h"
+
+#include "util/loading/load_param.h"
+#include "util/loading/factory.h"
+
+#include "p_node.h"
+#include "state.h"
+
+#include "glincl.h"
+//#include "shell_command.h"
+#include "debug.h"
+
+
+#define GLX_GLXEXT_PROTOTYPES
+//#include <GL/glx.h>
+// #include <GL/glut.h>
+
+//#include <GL/glext.h> //OpenGL Extensions
+//#include <GL/glxext.h> // GLX Extensions
+
+#ifndef GL_EXT_fog_coord
+#define GL_EXT_fog_coord 1
+typedef void (APIENTRY * PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
+typedef void (APIENTRY * PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
+typedef void (APIENTRY * PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
+typedef void (APIENTRY * PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
+#endif
+
+PFNGLFOGCOORDFEXTPROC glFogCoordfEXT = 0;
+PFNGLFOGCOORDFVEXTPROC glFogCoordfvEXT = 0;
+PFNGLFOGCOORDDEXTPROC glFogCoorddEXT = 0;
+PFNGLFOGCOORDDVEXTPROC glFogCoorddvEXT = 0;
+PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXT = 0;
+
+
+#include "class_id_DEPRECATED.h"
+ObjectListDefinitionID(VolFogEffect, CL_VOLFOG_EFFECT);
+CREATE_FACTORY(VolFogEffect);
+
+VolFogEffect::VolFogEffect(const TiXmlElement* root) {
+  this->registerObject(this, VolFogEffect::_objectList);
+
+    if (root != NULL)
+        this->loadParams(root);
+
+    // Initialize Effect
+    this->init();
+
+    // Activate Effect
+    this->activate();
+}
+
+
+VolFogEffect::~VolFogEffect() {
+    this->deactivate();
+}
+
+void VolFogEffect::loadParams(const TiXmlElement* root) {
+    WeatherEffect::loadParams(root);
+}
+
+void VolFogEffect::init() {
+    PRINTF(3)("Initalize VolFogEffect\n");
+
+    // set fog mode
+    GLenum fogMode  = GL_EXP;
+
+    // set fog density
+    float  fogDensity  = 0.001f;
+
+    // set fog near & far distance
+    float fogStart = 0.0f;
+    float fogEnd   = 1000.0f;
+
+    // Set fog color
+    float fogColor[4] = {0.6f,0.58f,0.79f,0.0f};
+
+
+    /*    glFogCoordfEXT       = (PFNGLFOGCOORDFEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfEXT");
+    glFogCoordfvEXT      = (PFNGLFOGCOORDFVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordfvEXT");
+    glFogCoorddEXT       = (PFNGLFOGCOORDDEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddEXT");
+    glFogCoorddvEXT      = (PFNGLFOGCOORDDVEXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoorddvEXT");
+    glFogCoordPointerEXT = (PFNGLFOGCOORDPOINTEREXTPROC)glXGetProcAddressARB((const GLubyte*)"glFogCoordPointerEXT");
+    */
+    // set the fog attributes
+    glFogf (GL_FOG_START,  fogStart);
+    glFogf (GL_FOG_END,    fogEnd);
+    glFogfv(GL_FOG_COLOR,  fogColor);
+    glFogi (GL_FOG_MODE,   fogMode);
+    glFogf (GL_FOG_DENSITY,fogDensity);
+    glFogi (GL_FOG_COORDINATE_SOURCE_EXT,GL_FOG_COORDINATE_EXT);
+
+    // enable the fog
+    glEnable(GL_FOG);
+
+    if (glewInit() == GLEW_OK)
+        PRINTF(4)("glewInit OK\n");
+    else
+        PRINTF(4)("glewInit failed\n");
+
+    if (glewGetExtension("GL_EXT_fog_coord"))
+        PRINTF(4)("GL_EXT_fog_coord extension found\n");
+}
+
+
+void VolFogEffect::activate() {
+    PRINTF(3)("Activating VolFogEffect\n");
+}
+
+void VolFogEffect::deactivate() {
+    PRINTF(3)("Deactivating VolFogEffect\n");
+
+    glDisable(GL_FOG);
+}
+
+
+/**
+* draws the effect, if needed
+*/
+void VolFogEffect::draw() const {
+    glPushAttrib(GL_ENABLE_BIT);
+    glClearColor(fogColor[0],fogColor[1],fogColor[2],0.0f);
+    glShadeModel(GL_SMOOTH);
+    glEnable(GL_DEPTH_TEST);
+    glEnable(GL_CULL_FACE);
+    glCullFace(GL_BACK);
+
+    /* clear all pixels in colour buffer */
+    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+    /* Enable blending */
+    //glEnable(GL_BLEND);
+    //glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
+
+    int i;
+    glLoadIdentity();
+
+
+    glBegin( GL_LINES );
+    glNormal3f(0,1,0);
+    for(i=-20;i<=20;i+=2) {
+        float fog_c;
+        float diff[3];
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(i,0,-20);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(i,0,20);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(-20,0,i);
+
+        diff[0] = State::getCameraNode()->getAbsCoor().x - i;
+        diff[2] = State::getCameraNode()->getAbsCoor().z + 20;
+        diff[1] = State::getCameraNode()->getAbsCoor().y;
+        fog_c = 1.3f*sqrt(diff[0]*diff[0]+diff[1]*diff[1]+diff[2]*diff[2]);
+        glFogCoordfEXT(fog_c*2);
+        glVertex3f(20,0,i);
+    }
+    glEnd();
+
+    glPopAttrib();
+
+}
+
+
+/**
+* ticks the effect if there is any time dependancy
+*/
+void VolFogEffect::tick(float dt) {}
Index: /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/volfog_effect.h	(revision 9760)
@@ -0,0 +1,35 @@
+/**
+* @file volfog_effect.h
+*/
+
+#ifndef _VOLFOG_EFFECT
+#define _VOLFOG_EFFECT
+
+#include "vector.h"
+
+#include "weather_effect.h"
+#include "glincl.h"
+
+class VolFogEffect : public WeatherEffect
+{
+  ObjectListDeclaration(VolFogEffect);
+public:
+  VolFogEffect(const TiXmlElement* root = NULL);
+  virtual ~VolFogEffect();
+
+  virtual void loadParams(const TiXmlElement* root);
+
+  virtual void init();
+
+  virtual void activate();
+  virtual void deactivate();
+
+  virtual void draw() const;
+  virtual void tick(float dt);
+
+private:
+  GLfloat fogColor[4];
+
+};
+
+#endif  /* _VOLFOG_EFFECT */
Index: /branches/new_class_id/src/world_entities/weather_effects/weather_effect.cc
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/weather_effect.cc	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/weather_effect.cc	(revision 9760)
@@ -0,0 +1,74 @@
+
+
+/*
+   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: hdavid, amaechler
+*/
+
+// TODO: descriptions to loadparams, movealong unified, start activation
+
+#include "weather_effect.h"
+#include "util/loading/load_param.h"
+
+ObjectListDefinition(WeatherEffect);
+
+/**
+ * @param root The XML-element to load the WeatherEffect from
+ */
+WeatherEffect::WeatherEffect(const TiXmlElement* root)
+{
+  this->registerObject(this, WeatherEffect::_objectList);
+  this->bActivated = false;
+}
+
+
+/**
+ *  destroys a WeatherEffects
+ */
+WeatherEffect::~WeatherEffect()
+{
+
+}
+
+
+/**
+ * @param root The XML-element to load the WeatherEffects from
+ */
+void WeatherEffect::loadParams(const TiXmlElement* root)
+{
+  BaseObject::loadParams(root);
+}
+
+
+/**
+ *  initializes the graphics effect
+ */
+void WeatherEffect::init()
+{
+}
+
+
+
+/**
+ * draws the effect, if needed
+ */
+void WeatherEffect::draw() const
+{}
+
+
+
+/**
+ * ticks the effect if there is any time dependancy
+ */
+void WeatherEffect::tick(float dt)
+{}
+
Index: /branches/new_class_id/src/world_entities/weather_effects/weather_effect.h
===================================================================
--- /branches/new_class_id/src/world_entities/weather_effects/weather_effect.h	(revision 9760)
+++ /branches/new_class_id/src/world_entities/weather_effects/weather_effect.h	(revision 9760)
@@ -0,0 +1,38 @@
+/*!
+ * @file weather_effect.h
+ *
+ */
+
+#ifndef _WEATHER_EFFECT_H
+#define _WEATHER_EFFECT_H
+
+#include "base_object.h"
+
+
+class WeatherEffect : public BaseObject
+{
+  ObjectListDeclaration(WeatherEffect);
+
+  public:
+    WeatherEffect(const TiXmlElement* root = NULL);
+    virtual ~WeatherEffect();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual void init();
+
+    virtual void activate() = 0;
+    virtual void deactivate() = 0;
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline  bool isActivated() const { return this->bActivated; }
+
+
+  protected:
+    bool              bActivated;
+};
+
+
+#endif /* _WEATHER_EFFECT */
