Index: branches/water/src/world_entities/environments/mapped_water.cc
===================================================================
--- branches/water/src/world_entities/environments/mapped_water.cc	(revision 8622)
+++ branches/water/src/world_entities/environments/mapped_water.cc	(revision 8628)
@@ -32,4 +32,32 @@
   this->toList(OM_ENVIRON);
 
+  /// sets start values and parameters
+  this->initParams();
+  // now the standard values were loaded, if the values are specified in the .oxw file
+  // loadParams will overwrite the standard values with the specified values
+  if (root != NULL)
+    this->loadParams(root);
+
+  /// initialization of the textures
+  this->initTextures();
+
+  /// initialization of the shaders
+  this->initShaders();
+}
+
+/**
+ * @brief deltes shader and the uniform used by the camera
+ */
+MappedWater::~MappedWater()
+{
+  delete shader;
+  delete cam_uni;
+}
+
+/**
+ * @brief initialization of loadable parameters, sets start standard values
+ */
+void MappedWater::initParams()
+{
   // those standardvalues will be overwritten if they're also set in the oxw file
   this->setWaterPos(0, 0, 0);
@@ -41,64 +69,34 @@
   this->setNormalMapScale(0.25f);
 
-
-  if (root != NULL)
-    this->loadParams(root);
-
-  /// loads the textures
+  // initialization of the texture coords, speeds etc...
+  // normalUV wont change anymore
+  this->normalUV = this->waterUV * this->kNormalMapScale;
+  // move and move2 are used for the reflection and refraction, the values are changed in tick()
+  this->move = 0;
+  this->move2 = this->move * this->kNormalMapScale;
+}
+
+/**
+ * @brief initialization of the textures
+ */
+void MappedWater::initTextures()
+{
   // sets parameters for the textures
   this->textureSize = 512;
   unsigned int channels = 32;
   GLenum type = GL_RGBA;
+
   // set up refleciton texture
   Texture reflTex(GL_TEXTURE_2D, this->textureSize, this->textureSize, channels, type);
   mat.setDiffuseMap(reflTex, 0);
-  //mat.setDiffuseMap("pictures/refl.bmp", GL_TEXTURE_2D, 0);
-  // load refraction texture
+  // set up refraction texture
   Texture refrTex(GL_TEXTURE_2D, this->textureSize, this->textureSize, channels, type);
   mat.setDiffuseMap(refrTex, 1);
-  //mat.setDiffuseMap("pictures/refr.bmp", GL_TEXTURE_2D, 1);
   // load normal map
   mat.setDiffuseMap("pictures/normalmap.bmp", GL_TEXTURE_2D, 2);
   // load dudv map
   mat.setDiffuseMap("pictures/dudvmap.bmp", GL_TEXTURE_2D, 3);
-  // set up depth texture
-  //mat.setDiffuseMap("pictures/sky-replace.jpg", GL_TEXTURE_2D, 4);
-
-
-  // set the size of the refraction and reflection textures
-
-
-  // initialization of the texture coords, speeds etc...
-  // normalUV wont change anymore
-  this->normalUV = this->waterUV * this->kNormalMapScale;
-  // move and move2 are used for the reflection and refraction, the values are changed in tick()
-  this->move = 0.0f;
-  this->move2 = this->move * this->kNormalMapScale;
-
-
-  //unsigned int channels = 32;
-  //GLenum type = GL_RGBA;
-  //unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels];
-  //memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
-  //unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
-  //memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
-  // Register the texture with OpenGL and bind it to the texture ID
-  //mat.select();
-  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
-
-  // Create the texture and store it on the video card
-  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureReflection);
-
-  //gluBuild2DMipmaps(GL_TEXTURE_2D, channels, this->textureSize, this->textureSize, type,  GL_UNSIGNED_INT, pTexture);
-
-  //the same for the refraction
-  //glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
-  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
-/*
-  unsigned int channels = 32;
-  GLenum type = GL_RGBA;
-  unsigned int* pTextureReflection = new unsigned int [this->textureSize * this->textureSize * channels];
-  memset(pTextureReflection, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
-  //mat.select();*/
+
+  // sets texture parameters for reflection texture
   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(0));
   glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
@@ -106,9 +104,5 @@
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureReflection);
-
-
-  //unsigned int* pTextureRefraction = new unsigned int [this->textureSize * this->textureSize * channels];
-  //memset(pTextureRefraction, 0, this->textureSize * this->textureSize * channels * sizeof(unsigned int));
+  // sets texture parameters for refraction texture
   glBindTexture(GL_TEXTURE_2D, this->mat.getDiffuseTexture(1));
   glTexParameterf(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
@@ -116,32 +110,4 @@
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
   glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-  //glTexImage2D(GL_TEXTURE_2D, 0, channels, this->textureSize, this->textureSize, 0, type, GL_UNSIGNED_INT, pTextureRefraction);
-
-  // Set the texture quality
-
-
-  // Since we stored the texture space with OpenGL, we can delete the image data
-  //delete [] pTextureReflection;
-  //delete [] pTextureRefraction;
-
-
-  /// initialization of the shaders
-  this->initShaders();
-
-  /// fog, doesnt work the way i want it to work
-  /*this->fog = new FogEffect();
-  fog->setFogColor(0.1f, 0.2f, 0.4f);
-  fog->setFogRange(0.0f, 500.0f);
-  fog->setFogDensity(0.03f);*/
-}
-
-/**
- * @brief deltes shader and the uniform used by the camera
- */
-MappedWater::~MappedWater()
-{
-  delete shader;
-  delete cam_uni;
-  //delete fog;
 }
 
@@ -215,21 +181,21 @@
   glBegin(GL_QUADS);
   // The back left vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, waterUV);            // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, waterUV - move);        // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, normalUV + move2);     // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE0, 0, waterUV);            // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0, waterUV - move);        // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0, normalUV + move2);     // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                       // DUDV map texture
-  glVertex3f(0.0f, this->waterPos.y, 0.0f);
+  glVertex3f(0, this->waterPos.y, 0);
 
   // The front left vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, 0.0f, 0.0f);                  // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, 0.0f, 0.0f - move);           // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, 0.0f, 0.0f + move2);          // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE0, 0, 0);                  // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, 0, -move);           // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, 0, move2);          // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
-  glVertex3f(0.0f, this->waterPos.y, this->zWidth);
+  glVertex3f(0, this->waterPos.y, this->zWidth);
 
   // The front right vertice for the water
-  glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0.0f);             // Reflection texture
-  glMultiTexCoord2f(GL_TEXTURE1, waterUV, 0.0f - move);         // Refraction texture
-  glMultiTexCoord2f(GL_TEXTURE2, normalUV, 0.0f + move2);      // Normal map texture
+  glMultiTexCoord2f(GL_TEXTURE0, waterUV, 0);             // Reflection texture
+  glMultiTexCoord2f(GL_TEXTURE1, waterUV, -move);         // Refraction texture
+  glMultiTexCoord2f(GL_TEXTURE2, normalUV, move2);      // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
   glVertex3f(this->xWidth, this->waterPos.y, this->zWidth);
@@ -240,5 +206,5 @@
   glMultiTexCoord2f(GL_TEXTURE2, normalUV, normalUV + move2);  // Normal map texture
   glMultiTexCoord2f(GL_TEXTURE3, 0, 0);                        // DUDV map texture
-  glVertex3f(this->xWidth, this->waterPos.y, 0.0f);
+  glVertex3f(this->xWidth, this->waterPos.y, 0);
   glEnd();
 
@@ -291,6 +257,6 @@
   {
     // Translate the world, then flip it upside down
-    glTranslatef(0.0f, waterPos.y*2.0f, 0.0f);
-    glScalef(1.0, -1.0, 1.0);
+    glTranslatef(0, waterPos.y*2, 0);
+    glScalef(1, -1, 1);
 
     // Since the world is updside down we need to change the culling to FRONT
@@ -298,5 +264,5 @@
 
     // Set our plane equation and turn clipping on
-    double plane[4] = {0.0, 1.0, 0.0, -waterPos.y};
+    double plane[4] = {0, 1, 0, -waterPos.y};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
@@ -305,5 +271,5 @@
     // If the camera is below the water we don't want to flip the world,
     // but just render it clipped so only the top is drawn.
-    double plane[4] = {0.0, 1.0, 0.0, waterPos.y};
+    double plane[4] = {0, 1, 0, waterPos.y};
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
@@ -352,5 +318,5 @@
   if(pos.y > waterPos.y)
   {
-    double plane[4] = {0.0, -1.0, 0.0, waterPos.y}; 
+    double plane[4] = {0, -1, 0, waterPos.y}; 
     glClipPlane(GL_CLIP_PLANE0, plane);
 
@@ -360,5 +326,5 @@
   {
     glCullFace(GL_FRONT);
-    double plane[4] = {0.0, 1.0, 0.0, -waterPos.y}; 
+    double plane[4] = {0, 1, 0, -waterPos.y}; 
     glClipPlane(GL_CLIP_PLANE0, plane);
   }
Index: branches/water/src/world_entities/environments/mapped_water.h
===================================================================
--- branches/water/src/world_entities/environments/mapped_water.h	(revision 8622)
+++ branches/water/src/world_entities/environments/mapped_water.h	(revision 8628)
@@ -1,7 +1,7 @@
 /*!
  * @file mapped_water.h
- *
+ *  worldentity for flat, cool looking, mapped water
 */
-/* example input in .oxw file with the standard values
+/*! example input in .oxw file with the standard values
 <MappedWater>
   <waterpos>0,0,0</waterpos>
@@ -16,5 +16,4 @@
 
 
-
 #ifndef _MAPPED_WATER_H
 #define _MAPPED_WATER_H
@@ -23,5 +22,4 @@
 #include "material.h"
 #include "shader.h"
-#include "effects/fog_effect.h"
 
 
@@ -53,23 +51,25 @@
 
   private:
+    void initParams();
+    void initTextures();
     void initShaders();
 
   private:
-    Vector              waterPos;                   //!< position of the water
-    float               xWidth, zWidth;             //!< size of the water quad
-    Vector              lightPos;                   //!< position of the light that is used to render the reflection
-    float               waterAngle;                 //!< defines how much the water will be turned around the point waterPos
+    Vector              waterPos;               //!< position of the water
+    float               xWidth, zWidth;         //!< size of the water quad
+    Vector              lightPos;               //!< position of the light that is used to render the reflection
+    float               waterAngle;             //!< defines how much the water will be turned around the point waterPos
 
-    float               move;                       //!< textures coords, speeds, positions for the shaded textures....
+    float               move;                   //!< textures coords, speeds, positions for the shaded textures....
     float               move2;
-    float               waterUV;                    //!< size of the waves
-    float               waterFlow;                  //!< speed of the water
+    float               waterUV;                //!< size of the waves
+    float               waterFlow;              //!< speed of the water
     float               normalUV;
     float               kNormalMapScale;
 
-    int                 textureSize;                //!< height and width of the texture
+    int                 textureSize;            //!< height and width of the texture
     Material            mat;
     Shader*             shader;
-    Shader::Uniform*    cam_uni;                    //!< uniform that is used for the camera position
+    Shader::Uniform*    cam_uni;                //!< uniform that is used for the camera position
 };
 
