Index: branches/height_map/src/lib/graphics/importer/height_map.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6268)
+++ branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6270)
@@ -137,5 +137,5 @@
   //red_mat->specularTexture = NULL;
 
-  if(colour_map_name != NULL)
+  if(false /*colour_map_name != NULL*/)
   {
   colourMap = IMG_Load(colour_map_name);
@@ -154,10 +154,10 @@
 		 else       PRINTF(4)("oops! couldn't load %s for some reason.\n", colour_map_name);
 
-  const  char* texture_name = "pictures/ground1.tga";
+  const  char* texture_name = "pictures/ground.tga";
   tmp_mat->setDiffuseMap(texture_name);
   if(colourMap != NULL)
   {
-  colours = (unsigned char *) colourMap->pixels;
-  hasColourMap = true;
+  //colours = (unsigned char *) colourMap->pixels;
+  hasColourMap = false;
   }
   else
@@ -186,8 +186,5 @@
 {
 
-this->camera = State::getCamera();
-this->camCoords = this->camera->getAbsCoor();
-float x = this->camCoords.x + 300;
-float y = this->camCoords.z  + 100;
+
 
 tmp_mat->select();
@@ -203,7 +200,7 @@
 
 
- /*
+ 
  if(heightMap != NULL && heightMap->format->BitsPerPixel == 8 )
-	{}
+	
 	SDL_LockSurface(heightMap);
 
@@ -222,5 +219,5 @@
 	    for(int j = 0 ; j < heightMap->w -sampleRate  ;  j += sampleRate)
 	    {
-	    	if(true)
+	    	if(false)
 		{
 		float r = (float)colours[3*j+2  + 3*i*(heightMap->w )];
@@ -238,21 +235,27 @@
 		}
 		}
-
+		
+		this->addVertex(scaleX*(heightMap->h -i),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Top Right
 
 		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->addNormal(normalVectorField[i][j+sampleRate].y,normalVectorField[i][j+sampleRate].z,normalVectorField[i][j+sampleRate].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->addColor(0.5,0.5,0.5);
 
 
 	    }
-
-
-
-
-
-
+		
+		 j = (heightMap->w/sampleRate);
+
+		this->addVertex(scaleX*(heightMap->h -i),(double)(double)(-1000),scaleZ*(j+sampleRate)); // Top Right
+
+		height = heights[j+sampleRate + i*(heightMap->w )];
+		this->addNormal(normalVectorField[i][j+sampleRate].y,normalVectorField[i][j+sampleRate].z,normalVectorField[i][j+sampleRate].x);
+		this->addTexCoor(((j/sampleRate)%4)/4.0,((i/sampleRate)%4)/4.0);
+
+ 		this->addColor(0.5,0.5,0.5);
+
+					
 
 
@@ -271,20 +274,21 @@
 	    for(int j = 0 ; j < heightMap->w -sampleRate  ;  j += sampleRate)
 	    {
-
+		
 	    	this->addIndice(cnt);
+		this->addIndice(cnt+1 + (heightMap->w-sampleRate)/ sampleRate );
 		cnt ++;
 	    }
-		if(i%2 == 1)
-		{
-	   	this->newStripe();
-		}
-	}
-
-
-
-
-		     */
-
-	this->planeModel(10,10, 10,10);
+		cnt++;
+	
+	 this->newStripe();
+		
+	}
+
+
+
+
+		     
+
+	//this->planeModel(100,100, 100,100);
 
 	this->finalize();
@@ -293,170 +297,7 @@
 }
 
-/*
-void HeightMap::draw()
-{
-
-this->camera = State::getCamera();
-this->camCoords = this->camera->getAbsCoor();
-float x = this->camCoords.x + 300;
-float y = this->camCoords.z  + 100;
-
-// Draw a red rectangle to test getHeight
-
-red_mat->select();
-glBegin(GL_TRIANGLE_STRIP);
-glNormal3f(0,1,0);
-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;
- int offset = 0;
- int g = 0;
- float old_r = 0.0f;
- float old_g = 0.0f;
- float old_b = 0.0f;
- heights  = (unsigned char*) heightMap->pixels;
-
- bool colourChanged = true;
-
-  if(heightMap != NULL && heightMap->format->BitsPerPixel == 8 )
-	{
-	SDL_LockSurface(heightMap);
-
-		   glBegin(GL_TRIANGLE_STRIP);
-	for(int i = 0 ; i < heightMap->h -sampleRate ; i +=sampleRate)
-	{
-
-
-
-
-		int j = 0;
-
-/*
-                height = heights[j + i*(heightMap->w )];
-		glNormal3f(normalVectorField[i][j].y,normalVectorField[i][j].z,normalVectorField[i][j].x);
- 		glVertex3f(20*(heightMap->h -(i))-1000,(double)((double)(height)/1-300),20*(j)-1000); // Top Left
-
-			height = heights[j + (i+2)*(heightMap->w )];
- 		glNormal3f(normalVectorField[i+2][j].y,normalVectorField[i+2][j].z,normalVectorField[i+2][j].x);
- 		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)
-	    {
-	    	if(hasColourMap)
-		{
-		float r = (float)colours[3*j+2  + 3*i*(heightMap->w )];
-		float g = (float)colours[3*j+1 + 3*i*(heightMap->w)];
-		float b = (float)colours[3*j+0 + 3*i*(heightMap->w)];
-		colourChanged = old_r != r || old_g != g || old_b != b;
-		old_r = r;
-		old_g = g;
-		old_b = b;
-		if(colourChanged)
-		{
-		 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();
-		}
-		}
-		*/
-		//if(true/*(abs(-scaleX*i-x+5000) > 1100 || abs(scaleZ*j-y-2000)  > 1100 )*/){ //subdivide??
-		/*
-		height = heights[j+sampleRate + i*(heightMap->w )];
-		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
-
-		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);
-		glTexCoord2f(((j/sampleRate)%4)/4.0,1/4.0+((i/sampleRate)%4)/4.0);
-		//glTexCoord2f(0.0,0.0);
- 		glVertex3f(scaleX*(heightMap->h -(i+sampleRate)),(double)((double)(height)*scaleY),scaleZ*(j+sampleRate)); // Bottom Right
-
-		}
-		else
-		{
-			//red_mat->select();
-			//glEnd();
-
-
-
-			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);
-		//glTexCoord2f(0.0,0.0);
-		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();
-
-	}
-	SDL_UnlockSurface(heightMap);
-	glEnd();
-}
-
-}
-*/
+
+
+
 void HeightMap::generateNormalVectorField()
 {
