Index: branches/height_map/src/lib/graphics/importer/height_map.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6472)
+++ branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 6529)
@@ -37,6 +37,6 @@
 lowResModel  = new VertexArrayModel();
 
-this->load(i1,j1,i2,j2,hm,highResModel,4);
-this->load(i1,j1,i2,j2,hm,lowResModel, 32);
+this->load(i1,j1,i2,j2,hm,highResModel,2);
+this->load(i1,j1,i2,j2,hm,lowResModel, 8);
 }
 
@@ -84,5 +84,5 @@
 	int sampleRate = Res;
 	
-	unsigned char height = 0;
+	 float height = 0;
  	int offset = 0;
  	
@@ -128,12 +128,19 @@
 		 b = (float)colours[3*j+0 + 3*i*(heightMap->w)];
 		 }
-		height =  hm->heights[j+sampleRate + i*(heightMap->w )];
+		height = (float)(unsigned char) hm->heights[j +sampleRate+ i*(heightMap->w )];
+		height += (float)(unsigned char) hm->heights[j+ 1 + sampleRate + (i+1)*(heightMap->w )];
+		height +=  (float) (unsigned char) hm->heights[j -1+ sampleRate   + (i+1)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j +sampleRate+ (i+2)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j+sampleRate + (i)*(heightMap->w )];
+		
+		height=height/5.0;
+		
 		model->addVertex(scaleX*(heightMap->h -i) + shiftX ,((double)(height)*scaleY) + shiftY ,scaleZ*(j) + shiftZ); // Top Right	
 		model->addNormal(normalVectorField[i][j].y,normalVectorField[i][j].z,normalVectorField[i][j].x);
-		model->addTexCoor(((j/sampleRate)%texRate)/texRatef,((i/sampleRate)%texRate)/texRatef, ((j/sampleRate)%heightMap->w)/float(heightMap->w),((i/sampleRate)%heightMap->h)/float(heightMap->h));
-
+		model->addTexCoor((float)j /(texRate), (float)(i %heightMap->h)/(texRate));
+		
+		//PRINTF(0)("TexCoord:  %f %f \n",(float)j / 100.0, (float)(i %heightMap->h)/100.0);
+		
  		model->addColor(r/255.0,g/255.0,b/255.0);
-		
-		
 		w = j;
 	    }
@@ -142,5 +149,5 @@
 		model->addVertex(scaleX*(heightMap->h -i)+ shiftX,shiftY,scaleZ*(w)+ shiftZ); // Top Right
 		model->addNormal(normalVectorField[i][w].y,normalVectorField[i][w].z,normalVectorField[i][w].x);
-		model->addTexCoor((((w+sampleRate)/sampleRate)%4)/4.0,(((i+ sampleRate)/sampleRate)%4)/4.0);
+		model->addTexCoor((((w+sampleRate)/sampleRate))/4.0,(((i+ sampleRate)/sampleRate))/4.0);
  		model->addColor(r/255.0,g/255.0,b/255.0);
 		
@@ -187,5 +194,5 @@
 		model->addVertex(scaleX*(heightMap->h -i) + shiftX , shiftY ,scaleZ*(j) + shiftZ); // Top Right	
 		model->addNormal(normalVectorField[i][j].y,normalVectorField[i][j].z,normalVectorField[i][j].x);
-		model->addTexCoor(((j/sampleRate)%texRate)/texRatef,(((i - sampleRate)/sampleRate)%texRate)/texRatef, ((j/sampleRate)%heightMap->w)/float(heightMap->w),(((i - sampleRate) /sampleRate)%heightMap->h)/float(heightMap->h));
+		model->addTexCoor(((j/sampleRate))/texRatef,(((i - sampleRate)/sampleRate))/texRatef, ((j/sampleRate)%heightMap->w)/float(heightMap->w),(((i - sampleRate) /sampleRate)%heightMap->h)/float(heightMap->h));
  		model->addColor(r/255.0,g/255.0,b/255.0);		
 	
@@ -195,8 +202,14 @@
 	    {
 	    	int i = i1;
-	    	height =  hm->heights[j+sampleRate + i*(heightMap->w )];
+	    	height = (float)(unsigned char) hm->heights[j +sampleRate+ i*(heightMap->w )];
+		height += (float)(unsigned char) hm->heights[j+ 1 + sampleRate + (i+1)*(heightMap->w )];
+		height +=  (float) (unsigned char) hm->heights[j -1+ sampleRate   + (i+1)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j +sampleRate+ (i+2)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j+sampleRate + (i)*(heightMap->w )];
+		height=height/5.0;
+		
 		model->addVertex(scaleX*(heightMap->h -i) + shiftX , ((double)(height)*scaleY) +shiftY ,scaleZ*(j) + shiftZ); // Top Right	
 		model->addNormal(normalVectorField[i][j].y,normalVectorField[i][j].z,normalVectorField[i][j].x);
-		model->addTexCoor(((j/sampleRate)%texRate)/texRatef,(((i)/sampleRate)%texRate)/texRatef, ((j/sampleRate)%heightMap->w)/float(heightMap->w),(((i)/sampleRate)%heightMap->h)/float(heightMap->h));
+		model->addTexCoor(((j/sampleRate))/texRatef,(((i)/sampleRate))/texRatef, ((j/sampleRate)%heightMap->w)/float(heightMap->w),(((i)/sampleRate)%heightMap->h)/float(heightMap->h));
  		model->addColor(r/255.0,g/255.0,b/255.0);
 	    
@@ -228,5 +241,10 @@
 	    {
 	    	int i = i2;
-	    	height =  hm->heights[j+sampleRate + i*(heightMap->w )];
+	    		height = (float)(unsigned char) hm->heights[j +sampleRate+ i*(heightMap->w )];
+		height += (float)(unsigned char) hm->heights[j+ 1 + sampleRate + (i+1)*(heightMap->w )];
+		height +=  (float) (unsigned char) hm->heights[j -1+ sampleRate   + (i+1)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j +sampleRate+ (i+2)*(heightMap->w )];
+		height +=  (float)(unsigned char)hm->heights[j+sampleRate + (i)*(heightMap->w )];
+		height=height/5.0;
 		model->addVertex(scaleX*(heightMap->h -i) + shiftX , ((double)(height)*scaleY) +shiftY ,scaleZ*(j) + shiftZ); // Top Right	
 		model->addNormal(normalVectorField[i][j].y,normalVectorField[i][j].z,normalVectorField[i][j].x);
@@ -349,4 +367,5 @@
   colourMap = IMG_Load(colour_map_name);
   }
+  
   if(colourMap != NULL)
   		{
@@ -373,5 +392,5 @@
   
 	
-   heights  = (unsigned char*) heightMap->pixels;
+  heights  = (unsigned char*) heightMap->pixels;
 
 
@@ -409,5 +428,5 @@
 
 int i_min = 1;
-int i_max = (heightMap->h - tileSize)/ tileSize;
+int i_max = (heightMap->h - tileSize )/ tileSize;
 int j_min = 1;
 int j_max= (heightMap->w - tileSize) / tileSize;
Index: branches/height_map/src/lib/graphics/importer/height_map.h
===================================================================
--- branches/height_map/src/lib/graphics/importer/height_map.h	(revision 6472)
+++ branches/height_map/src/lib/graphics/importer/height_map.h	(revision 6529)
@@ -17,7 +17,7 @@
 
 
-#define texRate      4
+#define texRate      22
 #define texRatef     4.0f
-#define tileSize     64
+#define tileSize     32
 
 class SDL_Surface;
Index: branches/height_map/src/lib/graphics/importer/static_model.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/static_model.cc	(revision 6472)
+++ branches/height_map/src/lib/graphics/importer/static_model.cc	(revision 6529)
@@ -289,5 +289,5 @@
 	 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
+	
   if (groupName == NULL)
      return;
Index: branches/height_map/src/lib/graphics/importer/vertex_array_model.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6472)
+++ branches/height_map/src/lib/graphics/importer/vertex_array_model.cc	(revision 6529)
@@ -34,8 +34,5 @@
 {
 
-   this->tex1 = new Texture("pictures/ground.tga");
-  this->tex1->setName("test1");
-  this->tex2 = new Texture("pictures/heightmapHelloCM.bmp");
-  this->tex2->setName("test2");
+
 
   
@@ -182,6 +179,6 @@
   this->texCoords1.push_back(u);
   this->texCoords1.push_back(v);
-  this->texCoords2.push_back(w);
-  this->texCoords2.push_back(x);
+  //this->texCoords2.push_back(w);
+  //this->texCoords2.push_back(x);
   this->pModelInfo.numTexCoor++;
 }
@@ -190,6 +187,5 @@
   this->texCoords1.push_back(u);
   this->texCoords1.push_back(v);
-  this->texCoords2.push_back(0.0);
-  this->texCoords2.push_back(0.0);
+  
   this->pModelInfo.numTexCoor++;
 }
