Index: branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h	(revision 8734)
+++ branches/atmospheric_engine/src/lib/graphics/effects/cloud_effect.h	(revision 8771)
@@ -1,4 +1,5 @@
 /**
-* @file cloud_effect.h
+ * @file cloud_effect.h
+ * Creates clouds
 */
 
Index: branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc	(revision 8734)
+++ branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.cc	(revision 8771)
@@ -20,4 +20,5 @@
 #include "shell_command.h"
 
+// Define shell commands
 SHELL_COMMAND(activate, FogEffect, activateFog);
 SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
@@ -25,67 +26,80 @@
 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
 
-// TODO: Fix fades
-
 using namespace std;
 
 CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
 
+/**
+ * @brief standard constructor
+ */
 FogEffect::FogEffect(const TiXmlElement* root) {
     this->setClassID(CL_FOG_EFFECT, "FogEffect");
 
+    // 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;
+}
+
+/**
+ * @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);
-    LoadParam(root, "density", this, FogEffect, setFogDensity);
-    LoadParam(root, "range", this, FogEffect, setFogRange);
-    LoadParam(root, "color", this, FogEffect, setFogColor);
-    LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn);
-    LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut);
+    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");;
 
     LOAD_PARAM_START_CYCLE(root, element);
     {
-        LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption);
+      LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");;
     }
     LOAD_PARAM_END_CYCLE(element);
 }
 
-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;
-
-}
-
-
+/**
+ * @brief activates the fog effect
+ */
 void FogEffect::activate() {
     PRINTF(0)( "Activating FogEffect\n");
@@ -103,8 +117,9 @@
 
     glEnable(GL_FOG);
-
-}
-
-
+}
+
+/**
+ * @brief deactivates the fog effect
+ */
 void FogEffect::deactivate() {
     PRINTF(0)("Deactivating FogEffect\n");
@@ -115,7 +130,9 @@
 
     glDisable(GL_FOG);
-
-}
-
+}
+
+/**
+ * @brief draws the fog effect
+ */
 void FogEffect::draw() const {
 
@@ -123,5 +140,5 @@
         return;
 
-    // If Fog Fade
+    // If fog is fading
     if ( this->fogFadeInActivate || this->fogFadeOutActivate ) {
         if ( this->fogMode == GL_LINEAR)
@@ -132,4 +149,8 @@
 }
 
+/**
+ * @brief ticks the fog effect
+ * @param dt: tick float
+ */
 void FogEffect::tick(float dt) {
 
@@ -137,4 +158,5 @@
         return;
 
+    // If fog is fading in
     if ( this->fogFadeInActivate ) {
         this->localTimer += dt;
@@ -149,4 +171,5 @@
     }
 
+    // If fog is fading out
     if ( this->fogFadeOutActivate ) {
         this->localTimer += dt;
@@ -162,4 +185,7 @@
 }
 
+/**
+ * @brief fades the fog in
+ */
 void FogEffect::fadeInFog() {
 
@@ -183,8 +209,9 @@
     // set FogFadeIn activate
     this->fogFadeInActivate = true;
-
-}
-
-
+}
+
+/**
+ * @brief fades the fog out
+ */
 void FogEffect::fadeOutFog() {
 
@@ -205,5 +232,4 @@
     // Reset local timer
     this->localTimer = 0;
-
-}
-
+}
+
Index: branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h	(revision 8734)
+++ branches/atmospheric_engine/src/lib/graphics/effects/fog_effect.h	(revision 8771)
@@ -1,4 +1,5 @@
 /**
-* @file fog_effect.h
+ * @file fog_effect.h
+ * Generates simple openGL fog
 */
 
@@ -10,88 +11,103 @@
 #include "vector.h"
 
-class FogEffect : public WeatherEffect {
+class FogEffect : public WeatherEffect
+{
 public:
-    FogEffect(const TiXmlElement* root = NULL);
-    virtual ~FogEffect();
+  FogEffect(const TiXmlElement* root = NULL);
+  virtual ~FogEffect();
 
-    virtual void loadParams(const TiXmlElement* root);
+  virtual void loadParams(const TiXmlElement* root);
 
-    virtual void init();
+  virtual void init();
 
-    virtual void activate();
-    virtual void deactivate();
+  virtual void activate();
+  virtual void deactivate();
 
-    void activateFog() {
-        this->activate();
-    }
-    void deactivateFog() {
-        this->deactivate();
-    }
+  void activateFog()
+  {
+    this->activate();
+  }
 
-    virtual void draw() const;
-    virtual void tick(float dt);
+  void deactivateFog()
+  {
+    this->deactivate();
+  }
 
-    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;
-    }
+  virtual void draw() const;
+  virtual void tick(float dt);
 
-    inline void setFogOption(const std::string& option) {
-        if (option == "activate")
-            this->fogActivate = true;
-    }
+  inline void setFogMode(const std::string& mode)
+  {
+    this->fogMode = this->stringToFogMode(mode);
+  }
 
-    void fadeInFog();
-    void fadeOutFog();
+  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;
+  }
+
+  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;
-    }
+  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          fogActivate;
 
-    bool          fogFadeInActivate;
-    bool          fogFadeOutActivate;
+  bool          fogFadeInActivate;
+  bool          fogFadeOutActivate;
 
-    GLfloat       fogFadeInDuration;
-    GLfloat       fogFadeOutDuration;
+  GLfloat       fogFadeInDuration;
+  GLfloat       fogFadeOutDuration;
 
-    float         localTimer;
+  GLint         fogMode;
+  GLfloat       fogDensity;
+  GLfloat       fogFadeDensity;
 
-    GLint         fogMode;
-    GLfloat       fogDensity;
-    GLfloat       fogFadeDensity;
+  GLfloat       fogStart;
+  GLfloat       fogEnd;
+  GLfloat       fogFadeEnd;
 
-    GLfloat       fogStart;
-    GLfloat       fogEnd;
-    GLfloat       fogFadeEnd;
-
-    Vector        colorVector;
+  Vector        colorVector;
+  float         localTimer; 
 };
 
-
 #endif  /* _FOG_EFFECT */
Index: branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8734)
+++ branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.cc	(revision 8771)
@@ -1,12 +1,12 @@
 /*
   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
@@ -29,4 +29,5 @@
 #include "parser/tinyxml/tinyxml.h"
 
+// Define shell commands
 SHELL_COMMAND(activate, RainEffect, activateRain);
 SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
@@ -38,231 +39,269 @@
 CREATE_FACTORY(RainEffect, CL_RAIN_EFFECT);
 
-/* TODO:
-  - test multiple rain emitters <-- doesn't work
-  - Think about what happens with building poss. to hang movewithcam off
-  - Possible to activate lightening
-  - turn off visibility when in a building
-  - variable emitter size depending on playable
+/**
+ * @brief standard constructor
+ */
+RainEffect::RainEffect(const TiXmlElement* root)
+{
+  this->setClassID(CL_RAIN_EFFECT, "RainEffect");
+
+  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()
+{
+  //Default values
+  this->rainActivate = 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 = 0;
+  this->rainFadeOutDuration = 0;
+
+  this->rainMaxParticles = this->rainRate * this->rainLife;
+  this->localTimer = 0;
+  this->soundRainVolume = 0.3f;
+  this->emitter = new PlaneEmitter(this->rainSize);
+
+  lightMan = LightManager::getInstance();
+  this->rainAmbient = lightMan->getAmbientColor();
+}
+
+/**
+ * @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);
+
+  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(0)( "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);
+
+  // plays the rain sound and loops it 
+  this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+
+  // if there is wind, play the wind sound
+  if (this->rainWindForce != 0)
+    this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true);
+
+  if (this->rainFadeInDuration == 0)
+    lightMan->setAmbientColor(.1,.1,.1);
+}
+
+/**
+ * @brief deactivates the rain effect
+ */
+void RainEffect::deactivate()
+{
+  PRINTF(0)("Deactivating RainEffect\n");
+
+  this->rainActivate = false;
+  this->emitter->setSystem(NULL);
+
+  // Stop Sound
+  this->soundSource.stop();
+
+  // Restore Light Ambient
+  lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient);
+}
+
+/**
+ * @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->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration)
+  {
+    this->localTimer += dt;
+    float progress = this->localTimer / this->rainFadeInDuration;
+
+    // Dim Light
+    lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
+
+    // use alpha in color to fade in
+    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 (!this->soundSource.isPlaying())
+      this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
+
+    this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
+  }
+  else if ( this->rainFadeOutDuration != 0 )
+  {
+    if ( this->localTimer < this->rainFadeOutDuration )
+    {
+      this->localTimer += dt;
+      float progress = 1 - (this->localTimer / this->rainFadeOutDuration);
+
+      // Fade In Light
+      lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
+
+      // 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);
+    }
+    else
+      this->deactivate();
+  }
+}
+
+/**
+ * @brief starts raining slowly
 */
-
-RainEffect::RainEffect(const TiXmlElement* root) {
-    this->setClassID(CL_RAIN_EFFECT, "RainEffect");
-
-    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 * 5); // TODO: Figure out the correct value
-    }
-}
-
-RainEffect::~RainEffect() {
+void RainEffect::startRaining()
+{
+
+  if (this->rainActivate)
     this->deactivate();
 
-    if (this->rainBuffer != NULL)
-        ResourceManager::getInstance()->unload(this->rainBuffer);
-
-    if (this->windBuffer != NULL)
-        ResourceManager::getInstance()->unload(this->windBuffer);
-}
-
-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);
-
-    LOAD_PARAM_START_CYCLE(root, element);
-    {
-        LoadParam_CYCLE(element, "option", this, RainEffect, setRainOption);
-    }
-    LOAD_PARAM_END_CYCLE(element);
-
-}
-
-
-void RainEffect::init() {
-    //Default values
-    this->rainActivate = 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->rainMaxParticles = this->rainRate * this->rainLife;
-    this->rainWindForce  = 0;
-    this->rainFadeInDuration = 0;
-    this->rainFadeOutDuration = 0;
-    this->localTimer = 0;
-    this->soundRainVolume = 0.3f;
-
-    this->emitter = new PlaneEmitter(this->rainSize);
-
-    lightMan = LightManager::getInstance();
-    this->rainAmbient = lightMan->getAmbientColor();
-}
-
-
-SparkParticles* RainEffect::rainParticles = NULL;
-
-void RainEffect::activate() {
-    PRINTF(0)( "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);
-
-    this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
-
-    if (this->rainWindForce != 0)
-        this->soundSource.play(this->windBuffer, 0.1f * this->rainWindForce, true);
-
-    if (this->rainFadeInDuration == 0)
-        lightMan->setAmbientColor(.1,.1,.1);
-
-}
-
-
-void RainEffect::deactivate() {
-    PRINTF(0)("Deactivating RainEffect\n");
-
-    this->rainActivate = false;
-    this->emitter->setSystem(NULL);
-
-    // Stop Sound
-    this->soundSource.stop();
-
-    // Restore Light Ambient
-    lightMan->setAmbientColor(this->rainAmbient, this->rainAmbient, this->rainAmbient);
-
-}
-
-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->rainFadeInDuration != 0 && this->localTimer < this->rainFadeInDuration) {
-        this->localTimer += dt;
-        float progress = this->localTimer / this->rainFadeInDuration;
-
-        // Dim Light
-        lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
-
-        // use alpha in color to fade in
-        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
-        // this->soundSource.fadein(this->rainBuffer, 10);
-
-    } else if ( this->rainFadeOutDuration != 0 ) {
-        if ( this->localTimer < this->rainFadeOutDuration ) {
-            this->localTimer += dt;
-            float progress = 1 - (this->localTimer / this->rainFadeOutDuration);
-
-            // Fade In Light
-            lightMan->setAmbientColor(1 - progress * 0.9, 1 - progress * 0.9, 1 - progress * 0.9);
-
-            // 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
-            // this->soundSource.fadeout(this->rainBuffer, 10);
-
-        } else
-            this->deactivate();
-    }
-
-}
-
-void RainEffect::startRaining() {
-
-    if (this->rainActivate)
-        this->deactivate();
-
-    if (!this->rainFadeInDuration > 0)
-        this->rainFadeInDuration = 20;
-
-    this->localTimer = 0;
-
+  if (!this->rainFadeInDuration > 0)
+    this->rainFadeInDuration = 20;
+
+  this->localTimer = 0;
+
+  this->activate();
+}
+
+/**
+ * @brief stops raining slowly
+ */
+void RainEffect::stopRaining()
+{
+
+  if (!this->rainActivate)
     this->activate();
 
-}
-
-void RainEffect::stopRaining() {
-
-    if (!this->rainActivate)
-        this->activate();
-
-    if (!this->rainFadeOutDuration > 0)
-        this->rainFadeOutDuration = 20;
-
-    this->localTimer = 0;
-
-}
-
-void RainEffect::hideRain() {
-
+  if (!this->rainFadeOutDuration > 0)
+    this->rainFadeOutDuration = 20;
+
+  this->localTimer = 0;
+}
+
+/**
+ * @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/atmospheric_engine/src/lib/graphics/effects/rain_effect.h
===================================================================
--- branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h	(revision 8734)
+++ branches/atmospheric_engine/src/lib/graphics/effects/rain_effect.h	(revision 8771)
@@ -1,8 +1,11 @@
 /**
-* @file rain_effect.h
+ * @file rain_effect.h
+ * Generates rain using the particle engine
 */
 
 #ifndef _RAIN_EFFECT
 #define _RAIN_EFFECT
+
+#include "weather_effect.h"
 
 #include "vector.h"
@@ -16,97 +19,107 @@
 class LightManager;
 
-#include "weather_effect.h"
-
 #include "sound_buffer.h"
 #include "sound_source.h"
 
+class RainEffect : public WeatherEffect
+{
+public:
+  RainEffect(const TiXmlElement* root = NULL);
+  virtual ~RainEffect();
 
-class RainEffect : public WeatherEffect {
-public:
-    RainEffect(const TiXmlElement* root = NULL);
-    virtual ~RainEffect();
+  virtual void loadParams(const TiXmlElement* root);
 
-    virtual void loadParams(const TiXmlElement* root);
+  virtual void init();
 
-    virtual void init();
+  virtual void activate();
+  virtual void deactivate();
 
-    virtual void activate();
-    virtual void deactivate();
+  inline void activateRain()
+  {
+    this->activate();
+  }
 
-    inline void activateRain() {
-        this->activate();
-    }
+  inline void deactivateRain()
+  {
+    this->deactivate();
+  }
 
-    inline void deactivateRain() {
-        this->deactivate();
-    }
+  virtual void tick(float dt);
 
-    virtual void tick(float dt);
+  void startRaining();
+  void stopRaining();
 
-    void startRaining();
-    void stopRaining();
+  void hideRain();
 
-    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 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 setRainFadeIn(float fadein) {
-        this->rainFadeInDuration = fadein;
-    }
-    inline void setRainFadeOut(float fadeout) {
-        this->rainFadeOutDuration = fadeout;
-    }
-
-    inline void setRainOption(const std::string& option) {
-        if (option == "moverain")
-            this->rainMove = true;
-        if (option == "activate")
-            this->rainActivate = true;
-    }
+  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;
+  static SparkParticles*      rainParticles;
+  ParticleEmitter*            emitter;
 
-    GLfloat                     rainFadeInDuration;
-    GLfloat                     rainFadeOutDuration;
-    float                       localTimer;
+  float                       localTimer;
 
-    Vector                      rainCoord;
-    Vector2D                    rainSize;
-    GLfloat                     rainRate;
-    GLfloat                     rainVelocity;
-    GLfloat                     rainLife;
-    GLfloat                     rainMaxParticles;
-    int                         rainWindForce;
-    bool                        rainMove;
-    bool                        rainActivate;
+  GLfloat                     rainFadeInDuration;
+  GLfloat                     rainFadeOutDuration;
 
-    OrxSound::SoundSource       soundSource;
-    OrxSound::SoundBuffer*      rainBuffer;
-    OrxSound::SoundBuffer*      windBuffer;
+  Vector                      rainCoord;
+  Vector2D                    rainSize;
+  GLfloat                     rainRate;
+  GLfloat                     rainVelocity;
+  GLfloat                     rainLife;
+  GLfloat                     rainMaxParticles;
+  int                         rainWindForce;
+  bool                        rainMove;
+  bool                        rainActivate;
 
-    float                       soundRainVolume;
+  OrxSound::SoundSource       soundSource;
+  OrxSound::SoundBuffer*      rainBuffer;
+  OrxSound::SoundBuffer*      windBuffer;
 
-    LightManager*               lightMan;
-    GLfloat                     rainAmbient;
+  float                       soundRainVolume;
+
+  LightManager*               lightMan;
+  GLfloat                     rainAmbient;
 
 };
