Index: orxonox/trunk/src/light.cc
===================================================================
--- orxonox/trunk/src/light.cc	(revision 3597)
+++ orxonox/trunk/src/light.cc	(revision 3598)
@@ -27,4 +27,8 @@
 int lightsV[] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7};
 
+
+/**
+   \param lightNumber the Light Number to initiate
+*/
 Light::Light(int lightNumber)
 {
@@ -40,4 +44,7 @@
 }
 
+/**
+   \brief destroys a Light
+*/
 Light::~Light(void)
 {
@@ -57,9 +64,11 @@
   this->lightPosition[3] = 0.0;
 
-  glLightfv (GL_LIGHT0, GL_POSITION, this->lightPosition);
-}
-
-/**
-   \brief Sets a Position for the Light.
+  this->setAbsCoor(&position);
+
+  glLightfv (lightsV[this->lightNumber], GL_POSITION, this->lightPosition);
+}
+
+/**
+   \brief Sets a Position of this Light.
    \param x the x-coordinate
    \param y the y-coordinate
@@ -68,14 +77,9 @@
 void Light::setPosition(GLfloat x, GLfloat y, GLfloat z)
 {
-  this->lightPosition[0] = x;
-  this->lightPosition[1] = y;
-  this->lightPosition[2] = z;
-  this->lightPosition[3] = 0.0;
-
-  glLightfv (GL_LIGHT0, GL_POSITION, this->lightPosition);
-}
-
-/**
-   \brief sets an emitting Diffuse color for the Light
+  this->setPosition(Vector(x, y, z));
+}
+
+/**
+   \brief sets an emitting Diffuse color of this Light
    \param r red
    \param g green
@@ -89,9 +93,9 @@
   this->diffuseColor[3] = 1.0;
 
-  glLightfv (GL_LIGHT0, GL_DIFFUSE, this->diffuseColor);
-}
-
-/**
-   \brief sets an emitting Ambient color for the Light
+  glLightfv (lightsV[this->lightNumber], GL_DIFFUSE, this->diffuseColor);
+}
+
+/**
+   \brief sets an emitting Specular color of this Light
    \param r red
    \param g green
@@ -105,13 +109,12 @@
   this->specularColor[3] = 1.0;
 
-  glLightfv (GL_LIGHT0, GL_SPECULAR, this->specularColor);
+  glLightfv (lightsV[this->lightNumber], GL_SPECULAR, this->specularColor);
 }
 
 /**
    \brief Sets the AttenuationType of this Light Source
-   \param type the AttenuationType to set
-   \param factor the Factor to multipy the attenuation with
-
-   this actually just sets the following: glLightf(currentLight, type, factor)
+   \param constantAttenuation The Constant Attenuation of the Light
+   \param linearAttenuation The Linear Attenuation of the Light
+   \param quadraticAttenuation The Quadratic Attenuation of the Light
 */
 void Light::setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation)
@@ -139,5 +142,4 @@
 }
 
-
 /**
    \brief sets the cutoff angle of the Light.
@@ -150,4 +152,15 @@
 }
 
+/**
+   \returns the Position of the Light
+*/
+Vector Light::getPosition()
+{
+  return Vector(this->lightPosition[0], this->lightPosition[1], this->lightPosition[2]);
+}
+
+/**
+   \brief draws this Light. Being a World-entity the possibility to do this lies at hand.
+*/ 
 void Light::draw()
 {
@@ -156,4 +169,7 @@
 }
 
+/**
+   \brief Prints out some nice formated debug information about the Light
+*/
 void Light::debug(void)
 {
@@ -196,5 +212,5 @@
    
    first disables Lighting
-   then deletes all the lights
+
    then deletes the rest of the allocated memory
    and in the end sets the singleton Reference to zero.
@@ -291,5 +307,5 @@
     }
 
-  this->deleteLight(this->currentLight->lightNumber);
+  this->deleteLight(this->currentLight->getLightNumber());
 }
 
@@ -308,4 +324,18 @@
 }
 
+/**
+   \brief draws all the Lights in their appropriate position
+*/
+void LightManager::draw()
+{
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  for (int i; i < NUMBEROFLIGHTS; i++)
+    if (this->lights[i])
+	lights[i]->draw();
+}
+
+
+
 // set Attributes
 /**
@@ -325,28 +355,71 @@
 }
 
+/**
+   \brief sets The Position of the currently selected Light
+   \param position the new Position
+*/
 void LightManager::setPosition(Vector position)
 {
   this->currentLight->setPosition(position);
 }
+
+/**
+   \brief Sets a Position for the currently selected Light.
+   \param x the x-coordinate
+   \param y the y-coordinate
+   \param z the z-coordinate
+*/
 void LightManager::setPosition(GLfloat x, GLfloat y, GLfloat z)
 {
   this->currentLight->setPosition(x, y, z);
 }
+
+/**
+   \brief sets an emitting Diffuse color of the currently selected Light
+   \param r red
+   \param g green
+   \param b blue
+*/
 void LightManager::setDiffuseColor(GLfloat r, GLfloat g, GLfloat b)
 {
   this->currentLight->setDiffuseColor(r,g,b);
 }
+
+/**
+   \brief sets an emitting Specular color of the currently selected Light
+   \param r red
+   \param g green
+   \param b blue
+*/
 void LightManager::setSpecularColor(GLfloat r, GLfloat g, GLfloat b)
 {
   this->currentLight->setSpecularColor(r, g, b);
 }
+
+/**
+   \brief Sets the AttenuationType of th currently selecte LightSource Light Source
+   \param constantAttenuation The Constant Attenuation of the Light
+   \param linearAttenuation The Linear Attenuation of the Light
+   \param quadraticAttenuation The Quadratic Attenuation of the Light
+*/
 void LightManager::setAttenuation(float constantAttenuation, float linearAttenuation, float quadraticAttenuation)
 {
   this->currentLight->setAttenuation(constantAttenuation, linearAttenuation, quadraticAttenuation);
 }
+
+
+/**
+   \brief stets the direction of the Spot Light.
+   \param direction The direction of the Spot Light.
+*/
 void LightManager::setSpotDirection(Vector direction)
 {
   this->currentLight->setSpotDirection(direction);
 }
+
+/**
+   \brief sets the cutoff angle of the Light.
+   \param cutoff The cutoff angle.
+*/
 void LightManager::setSpotCutoff(GLfloat cutoff)
 {
@@ -366,6 +439,19 @@
     }
   else
-    return getPosition(currentLight->lightNumber);
-}
+    return this->currentLight->getPosition();
+}
+
+/**
+   \returns the Position of Light 
+   \param lightNumber lightnumber
+*/
+Vector LightManager::getPosition(int lightNumber)
+{
+  if (!this->lights[lightNumber])
+    return Vector(.0,.0,.0);
+  else
+    return this->lights[lightNumber]->getPosition();
+}
+
 
 /**
@@ -379,5 +465,5 @@
   PRINT(0)("Reference: %p\n", LightManager::singletonRef);
   if (this->currentLight)
-    PRINT(0)("current Light Nr: %d\n", this->currentLight->lightNumber);
+    PRINT(0)("current Light Nr: %d\n", this->currentLight->getLightNumber());
   PRINT(0)("Ambient Color: %f:%f:%f\n", this->ambientColor[0], this->ambientColor[0], this->ambientColor[0]);
   PRINT(0)("=== Lights ===\n");
