Index: branches/height_map/src/defs/class_id.h
===================================================================
--- branches/height_map/src/defs/class_id.h	(revision 5970)
+++ branches/height_map/src/defs/class_id.h	(revision 5976)
@@ -186,7 +186,8 @@
   CL_PROMITIVE_MODEL            =    0x00000808,
   CL_MD2Model                   =    0x00000809,
-  CL_LIGHT                      =    0x0000080a,
-  CL_PARTICLE_EMITTER           =    0x0000080b,
-  CL_PARTICLE_SYSTEM            =    0x0000080c,
+  CL_HEIGHT_MAP                 =    0x0000080a,
+  CL_LIGHT                      =    0x0000080b,
+  CL_PARTICLE_EMITTER           =    0x0000080c,
+  CL_PARTICLE_SYSTEM            =    0x0000080d,
   CL_ENVIRONMENT                =    0x00000810,
   CL_SHADER                     =    0x00000811,
Index: branches/height_map/src/lib/graphics/importer/height_map.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 5970)
+++ branches/height_map/src/lib/graphics/importer/height_map.cc	(revision 5976)
@@ -34,4 +34,5 @@
 HeightMap::HeightMap(const char* height_map_name = NULL) : Model()
 {
+   this->setClassID(CL_HEIGHT_MAP, "HeightMap");
 	heightMap =  IMG_Load(height_map_name);
 	    if(heightMap!=NULL) {
@@ -55,5 +56,5 @@
 void HeightMap::load()
 {
- int height = 0; 
+ long height = 0; 
  int offset = 0;
  char *  bmp = (char*) heightMap->pixels;
@@ -61,7 +62,8 @@
   if(heightMap != NULL /* && heightMap->format->BitsPerPixel == 8 */)
 	{
-		for(int i = 0; i < heightMap->h; i += 2)
+SDL_LockSurface(heightMap);
+		for(int i = 0; i < heightMap->h -1; i += 2)
 			{
-			for(int j = 0; j < heightMap->w;  j += 2)
+			for(int j = 0; j < heightMap->w -1;  j += 2)
 			{
 
@@ -69,17 +71,20 @@
 
 				
-				SDL_LockSurface(heightMap);
-					height = bmp[j + i*heightMap->w];
-					//height = heightMap->format->palette->colors[offset];
-				SDL_UnlockSurface(heightMap);	
-				this->addVertex(heightMap->h - i , ((long)( height)  / 10) - 15 ,heightMap->w - j);
+				
+					offset = bmp[j + i*heightMap->w];
+					height = heightMap->format->palette->colors[offset].r + heightMap->format->palette->colors[offset].g + heightMap->format->palette->colors[offset].b ;
+					
+				this->addVertex(heightMap->h - i , ((long)( height) / 30) - 60 ,heightMap->w - j);
 			}	
 			}
+SDL_UnlockSurface(heightMap);
+		for(int i = 0; i < (heightMap->h * heightMap->w)/4   -1  ; i ++)
+			{
+				 this->addFace (3, VERTEX_ONLY, i,i+1 ,i + (heightMap->w / 2) );
+				
+				  this->addFace (3, VERTEX_ONLY,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1, i+1 );
+				
 
-		for(int i = 0; i < (heightMap->h * heightMap->w) / 4 - heightMap->w /2 -1  ; i ++)
-			{
-				  this->addFace (3, VERTEX_ONLY, i,i+1 ,i + (heightMap->w / 2) );
-				
-				  this->addFace (3, VERTEX_ONLY, i+1,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1 );
+				//this->addFace (4 ,VERTEX_ONLY,i,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1, i+1 );
 			}
 		
Index: branches/height_map/src/lib/graphics/importer/model.cc
===================================================================
--- branches/height_map/src/lib/graphics/importer/model.cc	(revision 5970)
+++ branches/height_map/src/lib/graphics/importer/model.cc	(revision 5976)
@@ -771,4 +771,5 @@
   this->vertices->finalizeArray();
   this->vTexture->finalizeArray();
+printf("=================%s::%d\n", this->getClassName(), normals->getCount());
   if (normals->getCount() == 0) // vertices-Array must be built for this
     this->buildVertexNormals();
Index: branches/height_map/src/world_entities/terrain.cc
===================================================================
--- branches/height_map/src/world_entities/terrain.cc	(revision 5970)
+++ branches/height_map/src/world_entities/terrain.cc	(revision 5976)
@@ -24,4 +24,5 @@
 #include "resource_manager.h"
 #include "model.h"
+#include "material.h"
 #include "height_map.h"
 #include "glincl.h"
@@ -39,5 +40,6 @@
 
   this->init();
-  
+
+  this->tmp_mat = new Material();  
   // this->loadParams(root);
 
@@ -204,4 +206,7 @@
   Vector tmpRot = this->getAbsDir().getSpacialAxis();
   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+
+   this->tmp_mat->select();
+
   this->model->draw();
   if (this->objectList)
Index: branches/height_map/src/world_entities/terrain.h
===================================================================
--- branches/height_map/src/world_entities/terrain.h	(revision 5970)
+++ branches/height_map/src/world_entities/terrain.h	(revision 5976)
@@ -15,4 +15,5 @@
 // FORWARD DECLARATION
 class SpatialSeparation;
+class Material;
 
 //! A simple method to call a desired debug world.
@@ -43,4 +44,5 @@
  private:
    Model*              vegetation;
+   Material*           tmp_mat;
    int                 objectList;
 };
