Index: trunk/src/lib/graphics/effects/fog_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/fog_effect.cc	(revision 6772)
+++ trunk/src/lib/graphics/effects/fog_effect.cc	(revision 6815)
@@ -62,7 +62,8 @@
 void FogEffect::loadParams(const TiXmlElement* root)
 {
+  printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>.loadParms\n\n");
   GraphicsEffect::loadParams(root);
 
-   LoadParam(root, "fog-effect", this, FogEffect, setFogMode)
+   LoadParam(root, "fog-mode", this, FogEffect, setFogMode)
        .describe("sets the the fog mode {GL_LINEAR, GL_EXP, GL_EXP2}");
 
@@ -87,4 +88,5 @@
 bool FogEffect::activate()
 {
+  printf("fog==============================================>>>>>>>>>>>>>>>>>>>>>>>>...\n\n");
   PRINTF(4)( "Enabling Fog Effect, mode: %i, density: %f, start: %f, end: %f\n", this->fogMode, this->fogDensity,
              this->fogStart, this->fogEnd);
@@ -92,5 +94,5 @@
   glEnable(GL_FOG);
   {
-    GLfloat fogColor[4] = {0.5, 0.5, 0.5, 1.0};
+    GLfloat fogColor[4] = {0.6, 0.6, 0.6, 1.0};
 
     glFogi(GL_FOG_MODE, this->fogMode);
Index: trunk/src/lib/graphics/effects/graphics_effect.cc
===================================================================
--- trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 6772)
+++ trunk/src/lib/graphics/effects/graphics_effect.cc	(revision 6815)
@@ -72,2 +72,18 @@
 bool 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: trunk/src/lib/graphics/effects/graphics_effect.h
===================================================================
--- trunk/src/lib/graphics/effects/graphics_effect.h	(revision 6772)
+++ trunk/src/lib/graphics/effects/graphics_effect.h	(revision 6815)
@@ -25,5 +25,8 @@
     virtual bool deactivate() = 0;
 
-    inline bool isActivated() { return this->bActivated; }
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    inline bool isActivated() const { return this->bActivated; }
 
 
Index: trunk/src/lib/graphics/effects/lense_flare.cc
===================================================================
--- trunk/src/lib/graphics/effects/lense_flare.cc	(revision 6815)
+++ trunk/src/lib/graphics/effects/lense_flare.cc	(revision 6815)
@@ -0,0 +1,188 @@
+
+
+/*
+   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 "load_param.h"
+#include "factory.h"
+
+#include "glincl.h"
+#include "texture.h"
+
+#include "light.h"
+#include "state.h"
+
+#include "render2D/billboard.h"
+
+using namespace std;
+
+CREATE_FACTORY(LenseFlare, CL_LENSE_FLARE);
+
+
+
+/**
+ *  default constructor
+ * @param root The XML-element to load the LenseFlare from
+ */
+ LenseFlare::LenseFlare(const TiXmlElement* root)
+{
+  if (root != NULL)
+    this->loadParams(root);
+
+  this->flareMatrix = new float[14];
+  /*          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.25f;
+  this->flareMatrix[12] = 1.82f; this->flareMatrix[13] = 0.25f;
+}
+
+
+/**
+ *  destroys a LenseFlare
+ */
+LenseFlare::~LenseFlare()
+{
+  std::vector<Billboard*>::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);
+
+    LoadParam(root, "add-flare-texture", this, LenseFlare, addFlare)
+        .describe("adds a lensflare texture to the engine");
+}
+
+
+/**
+ * initializes the fog effect
+ */
+bool LenseFlare::init()
+{}
+
+
+/**
+ * activates the fog effect
+ */
+bool LenseFlare::activate()
+{
+  this->bActivated = true;
+}
+
+
+/**
+ * deactivates the fog effect
+ */
+bool LenseFlare::deactivate()
+{
+  this->bActivated = false;
+}
+
+
+/**
+ * converts a gl mode char to a GLint
+ * @param mode the mode character
+ */
+GLint LenseFlare::charToFogMode(const char* mode)
+{}
+
+
+/**
+ * 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 char* 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;
+  }
+
+  Billboard* bb = new Billboard(NULL);
+  bb->setTexture(textureName);
+  this->flares.push_back(bb);
+  PRINTF(0)("Added a Lenseflare Billboard with texture %s\n", textureName);
+
+  // the first flare belongs to the light source
+  if( this->flares.size() == 1 && this->lightSource != NULL)
+  {
+    bb->setBindNode(static_cast<PNode*>(this->lightSource));
+  }
+}
+
+
+
+/**
+ * tick the effect
+ */
+void LenseFlare::tick(float dt)
+{
+  if( unlikely(!this->bActivated || this->flares.size() == 0))
+    return;
+  // always update the screen center, it could be, that the window is resized
+  this->screenCenter = Vector(State::getResX()/2.0f, State::getResY()/2.0f, 0.0f);
+  // flare vector is the direction from the center to the light source
+  this->flareVector = this->flares[0]->getAbsCoor2D();
+  this->distance = this->flareVector.len();
+  this->flareVector.normalize();
+
+  // now calculate the new coordinates of the billboards
+  std::vector<Billboard*>::iterator it;
+  int i;
+  for( it = flares.begin(), i = 0; it != flares.end(); it++, i++)
+  {
+    // set the new position
+    (*it)->setAbsCoor2D(this->flareVector * this->flareMatrix[i * 2]);
+    PRINTF(0)("Drawing flare %i @ (%f, %f)\n", i, (this->flareVector * this->flareMatrix[i * 2]).x, (this->flareVector * this->flareMatrix[i * 2]).y);
+    // tick them
+    (*it)->tick(dt);
+  }
+}
+
+
+/**
+ * draws the LenseFlares
+ */
+void LenseFlare::draw() const
+{
+  if( !this->bActivated)
+    return;
+
+  std::vector<Billboard*>::const_iterator it;
+  for( it = flares.begin(); it != flares.end(); it++)
+    (*it)->draw();
+}
Index: trunk/src/lib/graphics/effects/lense_flare.h
===================================================================
--- trunk/src/lib/graphics/effects/lense_flare.h	(revision 6815)
+++ trunk/src/lib/graphics/effects/lense_flare.h	(revision 6815)
@@ -0,0 +1,59 @@
+/**
+ * @file lense_flare.h
+ *  lense flare effect
+ */
+
+#ifndef _LENSE_FLARE
+#define _LENSE_FLARE
+
+#include "graphics_effect.h"
+
+#include <vector>
+
+#include "vector.h"
+
+
+#define LF_MAX_FLARES 7
+
+
+class TiXmlElement;
+class Light;
+class Billboard;
+
+//! A class that handles LenseFlares. The LenseFlareManager operates on this.
+class LenseFlare : public GraphicsEffect
+{
+  public:
+    LenseFlare(const TiXmlElement* root = NULL);
+    virtual ~LenseFlare();
+
+    virtual void loadParams(const TiXmlElement* root);
+
+    virtual bool init();
+
+    virtual bool activate();
+    virtual bool deactivate();
+
+    virtual void draw() const;
+    virtual void tick(float dt);
+
+    void addFlare(const char* textureName);
+
+
+  private:
+    GLint charToFogMode(const char* mode);
+
+
+  private:
+    Light*                   lightSource;        //!< reference to the sun (or primary light source)
+    std::vector<Billboard*>  flares;             //!< the flares array
+
+    Vector                   flareVector;        //!< the axis to draw the flares on
+    float                    distance;           //!< distance from center to source
+    Vector                   screenCenter;       //!< the vector marking the center of the screen
+
+    float*                   flareMatrix;
+};
+
+
+#endif /* _LENSE_FLARE */
