Index: branches/height_map/src/world_entities/terrain.cc
===================================================================
--- branches/height_map/src/world_entities/terrain.cc	(revision 6102)
+++ branches/height_map/src/world_entities/terrain.cc	(revision 6103)
@@ -24,6 +24,8 @@
 #include "resource_manager.h"
 #include "model.h"
-
+#include "material.h"
+#include "height_map.h"
 #include "glincl.h"
+
 
 using namespace std;
@@ -36,9 +38,78 @@
 Terrain::Terrain (const TiXmlElement* root)
 {
+
   this->init();
-  this->loadParams(root);
-
-//  if (this->model != NULL)
-    //this->ssp = new SpatialSeparation((Model*)this->model, 10.0f);
+
+  this->tmp_mat = new Material();  
+  // this->loadParams(root);
+
+ char* heightmapName = ResourceManager::getFullName("pictures/heightmapHello.bmp");
+ HeightMap * hm = new HeightMap(heightmapName);
+
+ hm->load();
+ this->model=hm;
+
+ /*	this->model =  new HeightMap();
+   this->model->setName("HardCore");
+  this->model->addVertex (-0.5, -0.5, 0.5);
+  this->model->addVertex (0.5, -0.5, 0.5);
+  this->model->addVertex (-0.5, 0.5, 0.5);
+  this->model->addVertex (0.5, 0.5, 0.5);
+  this->model->addVertex (-0.5, 0.5, -0.5);
+  this->model->addVertex (0.5, 0.5, -0.5);
+  this->model->addVertex (-0.5, -0.5, -0.5);
+  this->model->addVertex (0.5, -0.5, -0.5);
+
+  this->model->addVertexTexture (0.0, 0.0);
+  this->model->addVertexTexture (1.0, 0.0);
+  this->model->addVertexTexture (0.0, 1.0);
+  this->model->addVertexTexture (1.0, 1.0);
+  this->model->addVertexTexture (0.0, 2.0);
+  this->model->addVertexTexture (1.0, 2.0);
+  this->model->addVertexTexture (0.0, 3.0);
+  this->model->addVertexTexture (1.0, 3.0);
+  this->model->addVertexTexture (0.0, 4.0);
+  this->model->addVertexTexture (1.0, 4.0);
+  this->model->addVertexTexture (2.0, 0.0);
+  this->model->addVertexTexture (2.0, 1.0);
+  this->model->addVertexTexture (-1.0, 0.0);
+  this->model->addVertexTexture (-1.0, 1.0);
+
+  this->model->addVertexNormal (0.0, 0.0, 1.0);
+  this->model->addVertexNormal (0.0, 0.0, 1.0);
+  this->model->addVertexNormal (0.0, 0.0, 1.0);
+  this->model->addVertexNormal (0.0, 0.0, 1.0);
+  this->model->addVertexNormal (0.0, 1.0, 0.0);
+  this->model->addVertexNormal (0.0, 1.0, 0.0);
+  this->model->addVertexNormal (0.0, 1.0, 0.0);
+  this->model->addVertexNormal (0.0, 1.0, 0.0);
+  this->model->addVertexNormal (0.0, 0.0, -1.0);
+  this->model->addVertexNormal (0.0, 0.0, -1.0);
+  this->model->addVertexNormal (0.0, 0.0, -1.0);
+  this->model->addVertexNormal (0.0, 0.0, -1.0);
+  this->model->addVertexNormal (0.0, -1.0, 0.0);
+  this->model->addVertexNormal (0.0, -1.0, 0.0);
+  this->model->addVertexNormal (0.0, -1.0, 0.0);
+  this->model->addVertexNormal (0.0, -1.0, 0.0);
+  this->model->addVertexNormal (1.0, 0.0, 0.0);
+  this->model->addVertexNormal (1.0, 0.0, 0.0);
+  this->model->addVertexNormal (1.0, 0.0, 0.0);
+  this->model->addVertexNormal (1.0, 0.0, 0.0);
+  this->model->addVertexNormal (-1.0, 0.0, 0.0);
+  this->model->addVertexNormal (-1.0, 0.0, 0.0);
+  this->model->addVertexNormal (-1.0, 0.0, 0.0);
+  this->model->addVertexNormal (-1.0, 0.0, 0.0);
+
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,0, 1,1,1, 3,3,2, 2,2,3);
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,2,4, 3,3,5, 5,5,6, 4,4,7);
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,4,8, 5,5,9, 7,7,10, 6,6,11);
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,6,12, 7,7,13, 1,9,14, 0,8,15);
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,16, 7,10,17, 5,11,18, 3,3,19);
+  this->model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,12,20, 0,0,21, 2,2,22, 4,13,23);
+
+      this->model->finalize(); */
+   
+ /*if (this->model != NULL)
+    this->ssp = new SpatialSeparation((AbstractModel*)this->model, 10.0f);*/
 }
 
@@ -56,5 +127,6 @@
   if (!strstr(fileName, ".obj") || !strstr(fileName, ".OBJ") )
     {
-      this->loadModel(fileName);
+      this->model = NULL;
+	//this->loadModel(fileName);
     }
   else
@@ -136,8 +208,11 @@
   glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
 
+   this->tmp_mat->select();
+
+  this->model->draw();
   if (this->objectList)
     glCallList(this->objectList);
-  else if (this->getModel())
-    this->getModel()->draw();
+  else if (this->model)
+    this->model->draw();
   if (this->vegetation)
     this->vegetation->draw();
@@ -145,6 +220,6 @@
 
   /* THIS IS ONLY FOR DEBUGGING INFORMATION */
-  if (this->ssp != NULL)
-    this->ssp->drawQuadtree();
+ // if (this->ssp != NULL)
+ //   this->ssp->drawQuadtree();
 }
 
