Index: code/branches/shaders/src/orxonox/graphics/LensFlare.cc
===================================================================
--- code/branches/shaders/src/orxonox/graphics/LensFlare.cc	(revision 9491)
+++ code/branches/shaders/src/orxonox/graphics/LensFlare.cc	(revision 9500)
@@ -51,4 +51,13 @@
         RegisterObject(LensFlare);
         
+        this->lensConfiguration_=new std::vector<LensFlare::Lens*>();
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/burst"),1.0f,1.0f,1.0f)); //main burst
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/bursthalo"),0.7f,0.9f,1.0f)); //halo around main burst
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/halo1"),0.4f,0.2f,0.8f)); //all the different distanced lenses
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/halo2"),0.7f,0.3f,0.7f));
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/halo3"),0.3f,0.4f,0.6f));
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/halo3"),0.1f,0.8f,0.4f));
+        this->lensConfiguration_->push_back(new LensFlare::Lens(new std::string("lensflare/halo1"),0.15f,0.5f,0.35f));
+        
         this->createBillboards();
         
@@ -67,4 +76,5 @@
         XMLPortParam(LensFlare, "fadeResolution", setFadeResolution, getFadeResolution, xmlelement, mode).defaultValues(7);
         XMLPortParam(LensFlare, "fadeExponent", setFadeExponent, getFadeExponent, xmlelement, mode).defaultValues(2.0f);
+        XMLPortParam(LensFlare, "colour", setColour, getColour, xmlelement, mode);
     }
     
@@ -82,5 +92,4 @@
     void LensFlare::createBillboards()
     {
-        //TODO: add more billboards, possibly do some cleaning up, by using a loop
         this->occlusionBillboard_ = new Billboard(this);
         this->occlusionBillboard_->setMaterial("lensflare/hoq");
@@ -90,33 +99,11 @@
         this->attach(this->occlusionBillboard_);
         
-        Billboard* burst = new Billboard(this);
-        burst->setMaterial("lensflare/burst");
-        burst->disableFrustumCulling();
-        burst->setVisible(true);
-        this->attach(burst);
-        
-        Billboard* bursthalo = new Billboard(this);
-        bursthalo->setMaterial("lensflare/bursthalo");
-        bursthalo->disableFrustumCulling();
-        bursthalo->setVisible(true);
-        this->attach(bursthalo);
-        
-        bursthalo = new Billboard(this);
-        bursthalo->setMaterial("lensflare/halo1");
-        bursthalo->disableFrustumCulling();
-        bursthalo->setVisible(true);
-        this->attach(bursthalo);
-        
-        bursthalo = new Billboard(this);
-        bursthalo->setMaterial("lensflare/halo2");
-        bursthalo->disableFrustumCulling();
-        bursthalo->setVisible(true);
-        this->attach(bursthalo);
-        
-        bursthalo = new Billboard(this);
-        bursthalo->setMaterial("lensflare/halo3");
-        bursthalo->disableFrustumCulling();
-        bursthalo->setVisible(true);
-        this->attach(bursthalo);
+        for(std::vector<LensFlare::Lens*>::iterator it = lensConfiguration_->begin(); it != lensConfiguration_->end(); ++it) {
+            Billboard* lensPart=new Billboard(this);
+            lensPart->setMaterial(*(*it)->material_);
+            lensPart->disableFrustumCulling();
+            lensPart->setVisible(true);
+            this->attach(lensPart);
+        }
     }
 
@@ -133,14 +120,14 @@
     void LensFlare::updateBillboardStates(Vector3& viewDirection, float dimension, bool lightIsVisible)
     { 
-        //TODO: develop a more sane method for determining positions and scale factors of the flare components
-        //A good solution would probably be to introduce a data structure which stores a lens flare configuration
-        int i=0;
-        float step=0.0f;
-        for(std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++) {
+        this->occlusionBillboard_->setDefaultDimensions(dimension*0.5f,dimension*0.5f);
+        this->occlusionBillboard_->setVisible(lightIsVisible);
+        std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin();
+        it++;
+        for(int i=0; it != this->getAttachedObjects().end(); it++) {
             Billboard* billboard=static_cast<Billboard*>(*it);
-            billboard->setPosition(-viewDirection*step);
+            LensFlare::Lens* lens=lensConfiguration_->at(i);
+            billboard->setPosition(-viewDirection*(1.0f-lens->position_));
             billboard->setVisible(lightIsVisible);
-            billboard->setDefaultDimensions((i==0?0.5f:1.0f)*(i>2?0.25f:1.0f)*dimension*std::pow((1.0f-step),-1.0f),(i==0?0.5f:1.0f)*(i>2?0.25f:1.0f)*dimension*std::pow((1.0f-step),-1.0f));
-            step=0.25f*(i>2?(i-2):0);
+            billboard->setDefaultDimensions(dimension*lens->scale_,dimension*lens->scale_);
             i++;
         }
@@ -159,10 +146,9 @@
         it++;
         for(int i=0;it!=this->getAttachedObjects().end(); it++) {
-            if(i==2)
-            {
-                this->colour_->a*=0.33f;
-            }
+            ColourValue* cur=new ColourValue(0,0,0,0);
+            (*cur)+= *(this->colour_);
+            cur->a*=lensConfiguration_->at(i)->alpha_;
             Billboard* billboard=static_cast<Billboard*>(*it);
-            billboard->setColour(*(this->colour_));
+            billboard->setColour(*cur);
             i++;
         }
Index: code/branches/shaders/src/orxonox/graphics/LensFlare.h
===================================================================
--- code/branches/shaders/src/orxonox/graphics/LensFlare.h	(revision 9491)
+++ code/branches/shaders/src/orxonox/graphics/LensFlare.h	(revision 9500)
@@ -46,5 +46,5 @@
 
 namespace orxonox
-{
+{    
       /**
     @brief
@@ -61,4 +61,24 @@
     class _OrxonoxExport LensFlare : public StaticEntity, public Tickable
     {
+          /**
+          @brief
+              This is a nested Class used to easily set properties of the different sublenses of a LensFlare effect
+          */
+          class Lens
+          {
+              public:
+                  std::string* material_;//!< Which material should the Lens use, current choices include burst, bursthalo, halo1, halo2, halo3
+                  float alpha_;//!< Which base alpha value should the Lens use
+                  float scale_;//!< Which base scale should the Lens Flare have
+                  float position_;//!< This defines how far along the view direction the flare should be positioned, e.g. 0.5 would position the flare halfway between the viewer and the base burst, 0 at the camera, 1 at the burst
+                  Lens(std::string* material, float alpha, float scale, float position)
+                  {
+                      this->material_=material;
+                      this->alpha_=alpha;
+                      this->scale_=scale;
+                      this->position_=position;
+                  }
+          };
+          
         public:
             LensFlare(BaseObject* creator);
@@ -69,4 +89,24 @@
             inline float getScale() const
                 { return this->scale_; }
+                
+            /**
+            @brief
+                This sets the base colour of the billboards
+            @param colour
+                Vector3 containing r,g,b values
+            */
+            inline void setColour(const ColourValue& colour)
+            {
+                this->colour_->r=colour.r;
+                this->colour_->g=colour.g;
+                this->colour_->b=colour.b;
+            }
+            /**
+            @brief
+                This returns the current base colour of the billboards
+            @return a Vector3 containing r,g,b values
+            */
+            inline const ColourValue& getColour() const
+                { return *(new ColourValue(this->colour_->r,this->colour_->g,this->colour_->b)); }
                 
             /**
@@ -141,4 +181,5 @@
             unsigned int getPointCount(float dimension) const;
             
+            std::vector<Lens*>* lensConfiguration_;//!< this stores the lensConfiguration
             Billboard* occlusionBillboard_;//!< this is a transparent billboard used solely for the Hardware Occlusion Query
             float cameraDistance_;//!< current distance of the lensflare center from the camera
@@ -147,5 +188,4 @@
             unsigned int fadeResolution_;//!< how many points should be sampled per axis for the screen border fade. High number => smooth fade, but uses more processing power
             float fadeExponent_;//!< this determines how fast the flare fades away as it gets obstructed
-            //TODO: add XML port for colour manipulation
             ColourValue* colour_;//!< this stores the base colour of the light
     };
