Index: branches/height_map/src/lib/graphics/importer/height_map.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6266)
+++ branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6267)
@@ -35,10 +35,10 @@
 }
 
-HeightMap::HeightMap(const char* height_map_name = NULL) 
+HeightMap::HeightMap(const char* height_map_name = NULL)
 {
    this->setClassID(CL_HEIGHT_MAP, "HeightMap");
    heightMap =  IMG_Load(height_map_name);
    if(heightMap!=NULL) {
-	
+
 		 PRINTF(0)("loading Image %s\n", height_map_name);
 		 PRINTF(0)("width : %i\n", heightMap->w);
@@ -49,15 +49,15 @@
 		 PRINTF(0)("Gshift: %i\n", heightMap->format->Gshift);
 		 PRINTF(0)("Rmask: %i\n", heightMap->format->Rmask);
-		 PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);		
-		}
-		 
+		 PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);
+		}
+
      else       PRINTF(4)("oops! couldn't load %s for some reason.\n", height_map_name);
 
-		
+
 	   generateNormalVectorField();
-	   
-	   
+
+
  //Defines 2 Materials (for testing only!)
- this->tmp_mat = new Material(); 
+ this->tmp_mat = new Material();
   tmp_mat->setTransparency(1.0);
   tmp_mat->setIllum(0.3);
@@ -72,5 +72,5 @@
   tmp_mat->specularTexture = NULL;
 
- this->red_mat = new Material(); 
+ this->red_mat = new Material();
   red_mat->setTransparency(1.0);
   red_mat->setIllum(0.3);
@@ -93,5 +93,5 @@
    heightMap =  IMG_Load(height_map_name);
    if(heightMap!=NULL) {
-	
+
 		 PRINTF(0)("loading Image %s\n", height_map_name);
 		 PRINTF(0)("width : %i\n", heightMap->w);
@@ -102,15 +102,15 @@
 		 PRINTF(0)("Gshift: %i\n", heightMap->format->Gshift);
 		 PRINTF(0)("Rmask: %i\n", heightMap->format->Rmask);
-		 PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);		
-		}
-		 
+		 PRINTF(0)("Gmask: %i\n", heightMap->format->Gmask);
+		}
+
      else       PRINTF(4)("oops! couldn't load %s for some reason.\n", height_map_name);
 
-		
+
 	   generateNormalVectorField();
-	   
-	   
+
+
  //Defines 2 Materials (for testing only!)
- this->tmp_mat = new Material("tmp"); 
+ this->tmp_mat = new Material("tmp");
   tmp_mat->setTransparency(1.0);
   tmp_mat->setIllum(0.3);
@@ -120,9 +120,9 @@
   tmp_mat->setSpecular(0.0,0.00,0.00);
   tmp_mat->setShininess(1.0);
- 
-
-
-
- this->red_mat = new Material("red"); 
+
+
+
+
+ this->red_mat = new Material("red");
   red_mat->setTransparency(1.0);
   red_mat->setIllum(3);
@@ -136,5 +136,5 @@
  // red_mat->ambientTexture = NULL;
   //red_mat->specularTexture = NULL;
-  
+
   if(colour_map_name != NULL)
   {
@@ -153,5 +153,5 @@
 		 }
 		 else       PRINTF(4)("oops! couldn't load %s for some reason.\n", colour_map_name);
-		 
+
   const  char* texture_name = "pictures/ground1.tga";
   tmp_mat->setDiffuseMap(texture_name);
@@ -164,17 +164,17 @@
   {
   hasColourMap = false;
-  
- 
+
+
   }
-  
+
  // tmp_mat->setAmbientMap(texture_name);
   //tmp_mat->setSpecularMap(texture_name);
-  
+
   // red_mat->setDiffuseMap(texture_name);
   // red_mat->setAmbientMap(texture_name);
-  //red_mat->setSpecularMap(texture_name);		 		
+  //red_mat->setSpecularMap(texture_name);
   }
-  
- 
+
+
 }
 HeightMap::~HeightMap()
@@ -193,5 +193,5 @@
 tmp_mat->select();
 
-unsigned char height = 0; 
+unsigned char height = 0;
  int offset = 0;
  int g = 0;
@@ -201,22 +201,22 @@
  heights  = (unsigned char*) heightMap->pixels;
  bool colourChanged = true;
- 
- 
+
+
  /*
  if(heightMap != NULL && heightMap->format->BitsPerPixel == 8 )
 	{}
 	SDL_LockSurface(heightMap);
-	
-	
-		
+
+
+
 	for(int i = 0 ; i < heightMap->h -sampleRate ; i +=sampleRate)
 	{
-		
+
 		tmp_mat->select();
 
 
-		
+
 		int j = 0;
-	
+
 
 	    for(int j = 0 ; j < heightMap->w -sampleRate  ;  j += sampleRate)
@@ -235,34 +235,34 @@
 		tmp_mat->setAmbient(r/255.0,g/255.0,b/255.0);
 		tmp_mat->setDiffuse(r/255.0,g/255.0,b/255.0);
-		tmp_mat->select();	
-		}
-		}
-		
-		
+		tmp_mat->select();
+		}
+		}
+
+
 		height = heights[j+sampleRate + i*(heightMap->w )];
 		this->addNormal(normalVectorField[i][j+sampleRate].y,normalVectorField[i][j+sampleRate].z,normalVectorField[i][j+2].x);
 		this->addTexCoor(((j/sampleRate)%4)/4.0,((i/sampleRate)%4)/4.0);
-		
- 		this->addVertex(scaleX*(heightMap->h -i),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Top Right		
-				
-		
-		
+
+ 		this->addVertex(scaleX*(heightMap->h -i),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Top Right
+
+
+
 	    }
-		
-			
-			
-
-			
-			
-	
-
-		
-		}
-		
-	   
-	
+
+
+
+
+
+
+
+
+
+		}
+
+
+
 	SDL_UnlockSurface(heightMap);
-	
-	
+
+
 	int cnt = 0;
 	for(int i = 0 ; i < heightMap->h -sampleRate ; i +=sampleRate)
@@ -271,6 +271,6 @@
 	    for(int j = 0 ; j < heightMap->w -sampleRate  ;  j += sampleRate)
 	    {
-	    	
-	    	this->addIndice(cnt);	
+
+	    	this->addIndice(cnt);
 		cnt ++;
 	    }
@@ -279,12 +279,12 @@
 	   	this->newStripe();
 		}
-	}	
-	
-	
-	
-	
+	}
+
+
+
+
 		     */
-	
-	this->planeModel();
+
+        this->planeModel(10.0, 10.0, 20, 20);
 
 	this->finalize();
@@ -294,5 +294,5 @@
 
 /*
-void HeightMap::draw() 
+void HeightMap::draw()
 {
 
@@ -309,25 +309,25 @@
 glTexCoord2d(1.0,0.0);
  glVertex3f(x-10,getHeight(x-10,y+10)+5.0f	 ,y+10); // Top Left
- 
+
 
 glNormal3f(0,1,0);
 glTexCoord2d(1.0,1.0);
  glVertex3f(x+10,getHeight(x+10,y+10)+5.0f ,y+10); // Top Left
- 
+
 
 glNormal3f(0,1,0);
 glTexCoord2d(0.0,0.0);
  glVertex3f(x-10,getHeight(x-10,y-10)+5.0f ,y-10); // Top Left
- 
+
 
 glNormal3f(0,1,0);
 glTexCoord2d(0.0,1.0);
  glVertex3f(x+10,getHeight(x+10,y-10)+5.0f ,y-10); // Top Left
- 
+
 glEnd();
 
 tmp_mat->select();
 
-unsigned char height = 0; 
+unsigned char height = 0;
  int offset = 0;
  int g = 0;
@@ -338,10 +338,10 @@
 
  bool colourChanged = true;
- 
+
   if(heightMap != NULL && heightMap->format->BitsPerPixel == 8 )
 	{
 	SDL_LockSurface(heightMap);
 
-		   glBegin(GL_TRIANGLE_STRIP);	
+		   glBegin(GL_TRIANGLE_STRIP);
 	for(int i = 0 ; i < heightMap->h -sampleRate ; i +=sampleRate)
 	{
@@ -349,7 +349,7 @@
 
 
-		
+
 		int j = 0;
-	
+
 /*
                 height = heights[j + i*(heightMap->w )];
@@ -361,5 +361,5 @@
  		glVertex3f(20*(heightMap->h -(i+2))-1000,(double)((double)(height)/1-300),20*(j)-1000); // Bottom Left
 
-*/		
+*/
 /*
 	    for(int j = 0 ; j < heightMap->w -sampleRate  ;  j += sampleRate)
@@ -378,5 +378,5 @@
 		 tmp_mat->setAmbient(r/255.0,g/255.0,b/255.0);
 		 tmp_mat->setDiffuse(r/255.0,g/255.0,b/255.0);
-		tmp_mat->select();	
+		tmp_mat->select();
 		}
 		}
@@ -387,7 +387,7 @@
 		glNormal3f(normalVectorField[i][j+sampleRate].y,normalVectorField[i][j+sampleRate].z,normalVectorField[i][j+2].x);
 		glTexCoord2f(((j/sampleRate)%4)/4.0,((i/sampleRate)%4)/4.0);
-		
- 		glVertex3f(scaleX*(heightMap->h -i),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Top Right		
-				
+
+ 		glVertex3f(scaleX*(heightMap->h -i),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Top Right
+
 		height = heights[j+sampleRate + (i+sampleRate)*(heightMap->w )];
  		glNormal3f(normalVectorField[i+sampleRate][j+sampleRate].y,normalVectorField[i+sampleRate][j+sampleRate].z,normalVectorField[i+sampleRate][j+sampleRate].x);
@@ -395,5 +395,5 @@
 		//glTexCoord2f(0.0,0.0);
  		glVertex3f(scaleX*(heightMap->h -(i+sampleRate)),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Bottom Right
- 
+
 		}
 		else
@@ -401,38 +401,38 @@
 			//red_mat->select();
 			//glEnd();
-			
-			
-			
-			glBegin(GL_TRIANGLE_STRIP);	
-			
+
+
+
+			glBegin(GL_TRIANGLE_STRIP);
+
 				drawRect(j,i+sampleRate/2,j+sampleRate/2,i);
 			glEnd();
 			glBegin(GL_TRIANGLE_STRIP);
-				
-				
+
+
 				drawRect(j+sampleRate/2,i+sampleRate/2,j+sampleRate,i);
 			glEnd();
 			glBegin(GL_TRIANGLE_STRIP);
-				
-			
+
+
 				drawRect(j,i+sampleRate,j+sampleRate/2,i+sampleRate/2);
 			glEnd();
 			glBegin(GL_TRIANGLE_STRIP);
 				drawRect(j+sampleRate/2,i+sampleRate,j+sampleRate,i+sampleRate/2);
-			
+
 			glEnd();
-			
-			
-
-			
-			
+
+
+
+
+
 			//subdivide
 		}
 
-		
+
 		}
 		j =  heightMap->w -sampleRate;
-	     	
-		
+
+
  		glNormal3f(normalVectorField[i+sampleRate][j+sampleRate].y,normalVectorField[i+sampleRate][j+sampleRate].z,normalVectorField[i+sampleRate][j+sampleRate].x);
 		//glTexCoord2f(((j/sampleRate)%4)/4.0,1/4.0+((i/sampleRate)%4)/4.0);
@@ -440,16 +440,16 @@
 		glTexCoord2f(((j/sampleRate)%4)/4.0,((i/sampleRate)%4)/4.0);
 		glVertex3f(scaleX*(heightMap->h -i),(double)((double)-1000.0),scaleZ*(j+sampleRate)); // Top Right
-		
+
 		glNormal3f(normalVectorField[i+sampleRate][j+sampleRate].y,normalVectorField[i+sampleRate][j+sampleRate].z,normalVectorField[i+sampleRate][j+sampleRate].x);
 				glTexCoord2f(((j/sampleRate)%4)/4.0,1/4.0+((i/sampleRate)%4)/4.0);
-	
+
  		glVertex3f(scaleX*(heightMap->h -(i+sampleRate)),(double)-1000.0,scaleZ*(j+sampleRate)); // Bottom Right
 
-	     	
-		
-				
-	     
-		//glEnd();	
-	   
+
+
+
+
+		//glEnd();
+
 	}
 	SDL_UnlockSurface(heightMap);
@@ -480,17 +480,17 @@
 	    for(int j = 0; j < heightMap->w  -1  ;  j ++)
 	    {
-		
+
 
 		delta = (int)heights[j + (i+1)*(heightMap->w )] -  (int) heights[j + i*(heightMap->w )];
 		Vector a =  Vector(-20.0,(float)delta  ,0.0f);
-	
+
 		delta = (int)heights[j+1 + i*(heightMap->w )] - (int)heights[j + i*(heightMap->w )];
 		Vector b =  Vector(0.0f,(float) delta ,20.0);
-		
-	
+
+
 		 normalVectorField[i][j] = b.cross(a);
 		 normalVectorField[i][j].normalize();
-	
-	     }	
+
+	     }
 	}
 	SDL_UnlockSurface(heightMap);
@@ -505,5 +505,5 @@
 	if(true)
 	{
-		
+
 		height = heights[xTop + yTop*(heightMap->w )];
 		glNormal3f(normalVectorField[yTop][xTop].y,normalVectorField[yTop][xTop].z,normalVectorField[yTop][xTop].x);
@@ -515,10 +515,10 @@
 		glTexCoord2f(((yBottom/sampleRate)%8)/8.0,((xBottom/sampleRate)%8)/8.0+0.125);
  		glVertex3f(scaleX*(heightMap->h -(yTop)),(double)((double)(height)*scaleY),scaleZ*(xBottom)); // Top Left
-		
+
 		height = heights[xTop + (yBottom)*(heightMap->w )];
  		glNormal3f(normalVectorField[yBottom][xTop].y,normalVectorField[yBottom][xTop].z,normalVectorField[yBottom][xTop].x);
 		glTexCoord2f(((yBottom/sampleRate)%8)/8.0+0.125,((yBottom/sampleRate)%8)/8.0);
  		glVertex3f(scaleX*(heightMap->h -(yBottom)),(double)((double)(height)*scaleY),scaleZ*(xTop)); // Bottom Right
-		
+
 height = heights[xBottom + (yBottom)*(heightMap->w )];
  		glNormal3f(normalVectorField[yBottom][xBottom].y,normalVectorField[yBottom][xBottom].z,normalVectorField[yBottom][xBottom].x);
@@ -526,5 +526,5 @@
  		glVertex3f(scaleX*(heightMap->h -(yBottom)),(double)((double)(height)*scaleY),scaleZ*(xBottom)); // Bottom Left
 
-		
+
 
 	}
@@ -533,5 +533,5 @@
 		// subdivide
 	}
-	
+
 }
 
@@ -541,29 +541,29 @@
 
 	int height = 0;
-	
+
 	for(int i= xTopRight; i < xBottomLeft ; i+= sampleRate)
 	{
-	
+
 	glBegin(GL_TRIANGLES);
-			
+
 			height = heights[yBottomLeft + (i + sampleRate)*(heightMap->w )];
 			glNormal3f(0,1,0);
 			glVertex3f(scaleX*(heightMap->h -i-sampleRate),scaleY*height,scaleZ*(yBottomLeft));
-			
+
 			height = heights[yBottomLeft + i*(heightMap->w )];
 			glNormal3f(0,1,0);
-			glVertex3f(scaleX*(heightMap->h -i),scaleY*height,scaleZ*(yBottomLeft)); 
-			
+			glVertex3f(scaleX*(heightMap->h -i),scaleY*height,scaleZ*(yBottomLeft));
+
 			height = heights[yBottomLeft + (i + sampleRate/2)*(heightMap->w )];
 			glNormal3f(0,1,0);
-			glVertex3f(scaleX*(heightMap->h -i - sampleRate/2),scaleY*height,scaleZ*(yBottomLeft)); 
-			
-			 
-			
+			glVertex3f(scaleX*(heightMap->h -i - sampleRate/2),scaleY*height,scaleZ*(yBottomLeft));
+
+
+
 			glEnd();
-				
-			
-				
-	
+
+
+
+
 	}
 	for(int j= yBottomLeft; j < yTopRight; j+= sampleRate)
@@ -572,14 +572,14 @@
 			height = heights[j + (xBottomLeft+sampleRate)*(heightMap->w )];
 			glNormal3f(-1,0,0);
-			glVertex3f(scaleX*(heightMap->h -xBottomLeft -sampleRate),scaleY*height,scaleZ*(j)); 
-			
+			glVertex3f(scaleX*(heightMap->h -xBottomLeft -sampleRate),scaleY*height,scaleZ*(j));
+
 			height = heights[j + sampleRate/2  + (xBottomLeft + sampleRate)*(heightMap->w )];
 			glNormal3f(-1,0,0);
-			glVertex3f(scaleX*(heightMap->h -xBottomLeft - sampleRate),scaleY*height,scaleZ*(j+sampleRate/2)); 
-			
+			glVertex3f(scaleX*(heightMap->h -xBottomLeft - sampleRate),scaleY*height,scaleZ*(j+sampleRate/2));
+
 			height = heights[j + sampleRate + (xBottomLeft + sampleRate)*(heightMap->w )];
 			glNormal3f(-1,0,0);
-			glVertex3f(scaleX*(heightMap->h -xBottomLeft-sampleRate),scaleY*height,scaleZ*(j+sampleRate)); 
-			
+			glVertex3f(scaleX*(heightMap->h -xBottomLeft-sampleRate),scaleY*height,scaleZ*(j+sampleRate));
+
 			glEnd();
 	}
@@ -597,5 +597,5 @@
 {
  int xInt = (int)x / scaleX;  x -= (float)xInt*scaleX; xInt = heightMap->h - xInt;
- int yInt = (int)y / scaleZ;    y -= (float)yInt*scaleZ;  
+ int yInt = (int)y / scaleZ;    y -= (float)yInt*scaleZ;
  if(xInt <= 0 || xInt >= heightMap->h || yInt <= 0 || yInt >= heightMap->w  ) return 0.0f;
  float height = heights[yInt + (xInt)*heightMap->w]*scaleY;
Index: branches/height_map/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6266)
+++ branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6267)
@@ -181,13 +181,7 @@
   // finalize the Arrays
   this->newStripe();
-
-  /*
-    glEnableClientState(GL_VERTEX_ARRAY |
-    GL_TEXTURE_COORD_ARRAY |
-    GL_NORMAL_ARRAY);
-  */
-
   this->bFinalized = true;
 }
+
 
 
@@ -201,27 +195,24 @@
 * This will inject a Cube, because this is the most basic model.
 */
-void VertexArrayModel::planeModel()
-{
-  GLuint sizeX = 20;
-  GLuint sizeY = 20;
-
+void VertexArrayModel::planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY)
+{
   GLuint i, j;
-  for (i = 0; i < sizeY; i++)
-    {
-      for (j = 0; j < sizeX; j++)
+  for (i = 0; i < resolutionY; i++)
+    {
+      for (j = 0; j < resolutionX; j++)
         {
-          this->addVertex((float)i - (float)sizeY/2.0, sin((float)i/(float)sizeY*5.0)*cos((float)j/(float)sizeX*5.0)*5.0, (float)j - (float)sizeX/2.0);
+          this->addVertex((float)i - (float)sizeY/2.0, 0.0, (float)j - (float)sizeX/2.0);
           this->addNormal(0.0, 1, 0.0);
-          this->addTexCoor((float)i/(float)sizeY, (float)j/(float)sizeY);
+          this->addTexCoor((float)i/(float)resolutionY, (float)j/(float)resolutionY);
           this->addColor((float)i/20.0, 0.0, (float)j/20.0);
         }
     }
 
-  for (i = 0; i < sizeY-1; i++)
-  {
-    for (j = 0; j < sizeX; j++)
-    {
-      this->addIndice( sizeY*i + j );
-      this->addIndice( sizeY*(i+1) + j );
+  for (i = 0; i < resolutionY-1; i++)
+  {
+    for (j = 0; j < resolutionX; j++)
+    {
+      this->addIndice( resolutionY*i + j );
+      this->addIndice( resolutionY*(i+1) + j );
     }
     this->newStripe();
@@ -231,4 +222,10 @@
 #include <cmath>
 
+/**
+ * @brief builds a Triangle Stripped sphere
+ * @param radius: radius
+ * @param loops: the count of loops
+ * @param segmentsPerLoop how many Segments per loop
+ */
 void VertexArrayModel::spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop)
 {
@@ -283,5 +280,7 @@
 
 
-
+/**
+ * @brief print out some nice debug information about this VertexArrayModel.
+ */
 void VertexArrayModel::debug() const
 {
Index: branches/height_map/src/lib/graphics/importer/vertex_array_model.h
===================================================================
--- branches/height_map/src/lib/graphics/importer/vertex_array_model.h	(revision 6266)
+++ branches/height_map/src/lib/graphics/importer/vertex_array_model.h	(revision 6267)
@@ -45,5 +45,5 @@
 
   //
-  void planeModel();
+  void planeModel(float sizeX, float sizeY, unsigned int resolutionX, unsigned int resolutionY);
   void spiralSphere(const float radius, const unsigned int loops, const unsigned int segmentsPerLoop);
 
