Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 6771)
+++ /trunk/src/defs/class_id.h	(revision 6772)
@@ -74,16 +74,19 @@
   CL_STORY_ENTITY               =    0x02000000,
 
+  CL_PHYSICS_INTERFACE          =    0x04000000,
+
+  CL_EVENT_LISTENER             =    0x08000000,
+
+  CL_ELEMENT_2D                 =    0x10000000,
+
+  CL_SYNCHRONIZEABLE            =    0x20000000,
+
+  CL_WORLD_ENTITY               =    0x40000000,
+
   CL_GAME_WORLD                 =    0x50000000,
   CL_GAME_WORLD_DATA            =    0x60000000,
 
-  CL_PHYSICS_INTERFACE          =    0x04000000,
-
-  CL_EVENT_LISTENER             =    0x08000000,
-
-  CL_ELEMENT_2D                 =    0x10000000,
-
-  CL_SYNCHRONIZEABLE            =    0x20000000,
-
-  CL_WORLD_ENTITY               =    0x40000000,
+  CL_GRAPHICS_EFFECT            =    0x70000000,
+
 
   // subsuper-classes derivations taken : 1, 2, 3, 5, a, b, c.     << THIS IS A LIST OF ALL THE DCL_MASK_SUBSUPERCLASS_ID's taken
@@ -258,4 +261,6 @@
   CL_ENVIRONMENT                =    0x00000821,
   CL_SHADER                     =    0x00000822,
+  CL_FOG_EFFECT                 =    0x70000001,
+
   // GL-GUI
   CL_GLGUI_WIDGET               =    0x00500000,
Index: /trunk/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/fog_effect.cc	(revision 6771)
+++ /trunk/src/lib/graphics/effects/fog_effect.cc	(revision 6772)
@@ -22,8 +22,11 @@
 #include "factory.h"
 
+#include "glincl.h"
+
+
 
 using namespace std;
 
-CREATE_FACTORY(FogEffect, CL_LIGHT);
+CREATE_FACTORY(FogEffect, CL_FOG_EFFECT);
 
 
@@ -35,4 +38,10 @@
  FogEffect::FogEffect(const TiXmlElement* root)
 {
+
+  this->fogMode = GL_EXP2;
+  this->fogDensity = 0.001f;
+  this->fogStart = 10.0f;
+  this->fogEnd = 1000.0f;
+
 
   if (root != NULL)
@@ -55,6 +64,12 @@
   GraphicsEffect::loadParams(root);
 
-//   LoadParam(root, "diffuse-color", this, FogEffect, setDiffuseColor)
-//       .describe("sets the diffuse color of the FogEffect (red [0-1], green [0-1], blue [0-1])");
+   LoadParam(root, "fog-effect", this, FogEffect, setFogMode)
+       .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}");
+
+   LoadParam(root, "fog-density", this, FogEffect, setFogDensity)
+       .describe("sets the the fog density of the exponentionl functions");
+
+   LoadParam(root, "fog-range", this, FogEffect, setFogRange)
+       .describe("sets the the range of the linear functions");
 }
 
@@ -72,15 +87,21 @@
 bool FogEffect::activate()
 {
-/*  glEnable(GL_FOG);
+  PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
+             this->fogStart, this->fogEnd);
+
+  glEnable(GL_FOG);
   {
-    GLfloat fogColor[4] = {0.5, 0.5, 1.0};
+    GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
 
-    GLint fogMode = GL_EXP;
-    glFogi(GL_FOG_MODE, fogMode);
+    glFogi(GL_FOG_MODE, this->fogMode);
     glFogfv(GL_FOG_COLOR, fogColor);
-    gfFogf(GL_FOG_DENSITY, 0.35f);
+    glFogf(GL_FOG_DENSITY, this->fogDensity);
+    glHint(GL_FOG_HINT, GL_DONT_CARE);
+    glFogf(GL_FOG_START, this->fogStart);
+    glFogf(GL_FOG_END, this->fogEnd);
 
-
-  }*/
+    //glFogi(GL_FOG_COORDINATE_SOURCE, GL_FOG_COORDINATE);
+  }
+  glClearColor(0.5, 0.5, 0.5, 1.0);
 }
 
@@ -90,3 +111,23 @@
  */
 bool FogEffect::deactivate()
-{}
+{
+  glDisable(GL_FOG);
+}
+
+
+/**
+ * converts a gl mode char to a GLint
+ * @param mode the mode character
+ */
+GLint FogEffect::charToFogMode(const char* mode)
+{
+  if( !strcmp( "GL_LINEAR", mode))
+    return GL_LINEAR;
+  else if( !strcmp("GL_EXP", mode))
+    return GL_EXP;
+  else if(!strcmp("GL_EXP2", mode) )
+    return GL_EXP2;
+  else
+    return -1;
+}
+
Index: /trunk/src/lib/graphics/effects/fog_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/fog_effect.h	(revision 6771)
+++ /trunk/src/lib/graphics/effects/fog_effect.h	(revision 6772)
@@ -24,4 +24,19 @@
     virtual bool activate();
     virtual bool deactivate();
+
+    void setFogMode(const char* mode) { this->fogMode = this->charToFogMode(mode); }
+    void setFogDensity(float density) { this->fogDensity = density; }
+    void setFogRange(float start, float end) { this->fogStart = start; this->fogEnd = end; }
+
+
+  private:
+    GLint charToFogMode(const char* mode);
+
+
+  private:
+    GLint                   fogMode;
+    GLfloat                 fogDensity;
+    GLfloat                 fogStart;
+    GLfloat                 fogEnd;
 };
 
Index: /trunk/src/lib/graphics/effects/graphics_effect.cc
===================================================================
--- /trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 6771)
+++ /trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 6772)
@@ -13,5 +13,4 @@
 ### File Specific:
    main-programmer: Patrick Boenzli
-   co-programmer: ...
 */
 
@@ -21,4 +20,5 @@
 #include "graphics_effect.h"
 
+#include "graphics_engine.h"
 #include "load_param.h"
 
@@ -35,4 +35,7 @@
 GraphicsEffect::GraphicsEffect(const TiXmlElement* root)
 {
+  this->bActivated = false;
+
+  this->bActivated = GraphicsEngine::getInstance()->loadGraphicsEffect(this);
 
   if (root != NULL)
@@ -45,5 +48,8 @@
  */
 GraphicsEffect::~GraphicsEffect()
-{}
+{
+  if( this->bActivated)
+    GraphicsEngine::getInstance()->unloadGraphicsEffect(this);
+}
 
 
Index: /trunk/src/lib/graphics/effects/graphics_effect.h
===================================================================
--- /trunk/src/lib/graphics/effects/graphics_effect.h	(revision 6771)
+++ /trunk/src/lib/graphics/effects/graphics_effect.h	(revision 6772)
@@ -24,4 +24,10 @@
     virtual bool activate() = 0;
     virtual bool deactivate() = 0;
+
+    inline bool isActivated() { return this->bActivated; }
+
+
+  protected:
+    bool              bActivated;
 };
 
Index: /trunk/src/lib/graphics/graphics_engine.cc
===================================================================
--- /trunk/src/lib/graphics/graphics_engine.cc	(revision 6771)
+++ /trunk/src/lib/graphics/graphics_engine.cc	(revision 6772)
@@ -37,4 +37,5 @@
 
 #include "effects/graphics_effect.h"
+#include "effects/fog_effect.h"
 
 #include "shell_command.h"
@@ -148,4 +149,9 @@
 
   this->initVideo(atoi(resolution.getString(0)), atoi(resolution.getString(1)), 16);
+
+  GraphicsEffect* fe = new FogEffect(NULL);
+  this->loadGraphicsEffect(fe);
+  fe->activate();
+  PRINTF(0)("--------------------------------------------------------------\n");
 }
 
Index: /trunk/src/world_entities/camera.cc
===================================================================
--- /trunk/src/world_entities/camera.cc	(revision 6771)
+++ /trunk/src/world_entities/camera.cc	(revision 6772)
@@ -178,8 +178,8 @@
 /**
  *  initialize rendering perspective according to this camera
-
-   This is called immediately before the rendering cycle starts, it sets all global
-   rendering options as well as the GL_PROJECTION matrix according to the camera.
-*/
+ *
+ * This is called immediately before the rendering cycle starts, it sets all global
+ * rendering options as well as the GL_PROJECTION matrix according to the camera.
+ */
 void Camera::apply ()
 {
@@ -193,11 +193,10 @@
                  this->nearClip,
                  this->farClip);
-
   // speed-up feature
   Vector cameraPosition = this->getAbsCoor();
   Vector targetPosition = this->target->getAbsCoor();
   Vector up = this->getAbsDirV();
-  Vector delay = Vector(0,0,0);
-  if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity())/25;
+  Vector delay = Vector(0, 0, 0);
+  if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity()) / 25.0f;
 
   // Setting the Camera Eye, lookAt and up Vectors
@@ -206,7 +205,6 @@
             up.x, up.y, up.z);
 
-  // switching back to Modeling Matrix
   glMatrixMode (GL_MODELVIEW);
-  //  this->target->getParent()->getParent()->debugDraw(0, 2, Vector(1,0,0));
+  glLoadIdentity();
 }
 
Index: /trunk/src/world_entities/skybox.cc
===================================================================
--- /trunk/src/world_entities/skybox.cc	(revision 6771)
+++ /trunk/src/world_entities/skybox.cc	(revision 6772)
@@ -225,6 +225,10 @@
   glDisable(GL_LIGHTING);
 
+  glPushAttrib(GL_ENABLE_BIT);
+  glDisable(GL_FOG);
+
   WorldEntity::draw();
 
+  glPopAttrib();
   glPopAttrib();
 
