Index: /trunk/src/lib/graphics/importer/height_map.cc
===================================================================
--- /trunk/src/lib/graphics/importer/height_map.cc	(revision 7490)
+++ /trunk/src/lib/graphics/importer/height_map.cc	(revision 7491)
@@ -133,27 +133,32 @@
 
     w = j1;
+
+    // add a vertex to the list
     model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i)+ shiftX,shiftY,scaleZ*(w)+ shiftZ); // Top Right
-    model->addNormal(normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].y,normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z,normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x);
+    model->addNormal(normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].y,
+                     normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z,
+                     normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x);
     model->addTexCoor((float)(j1-sampleRate) /(texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));
-
-    model->addColor(r/255.0,g/255.0,b/255.0);
-
-    for(int j = j1  ; j <= j2    ;  j += sampleRate)
-    {
-
-
-      // To be fixed
-      if(this->heightMapReference->hasColourMap)
+    model->addColor(r/255.0f,g/255.0f,b/255.0f);
+
+
+    for(int j = j1; j <= j2; j += sampleRate)
+    {
+      // adjust the colors acording to the color map
+      if( this->heightMapReference->hasColourMap)
       {
-        r = colors[(3*j+2 + 3*i*(this->heightMapReference->heightMap->w )) ];
-        g =  colors[(3*j+1 + 3*i*(this->heightMapReference->heightMap->w)) ];
-        b =  colors[(3*j+0 + 3*i*(this->heightMapReference->heightMap->w))];
+        r = colors[3 * j + 2 + 3 * i * (this->heightMapReference->heightMap->w)];
+        g = colors[3 * j + 1 + 3 * i * (this->heightMapReference->heightMap->w)];
+        b = colors[3 * j + 0 + 3 * i * (this->heightMapReference->heightMap->w)];
       }
-      height = (float)(unsigned char) this->heightMapReference->heights[(j +sampleRate+ i*(this->heightMapReference->heightMap->w )) ];
-      height += (float)(unsigned char) this->heightMapReference->heights[(j+ 1 + sampleRate + (i+1)*(this->heightMapReference->heightMap->w )) ];
-      height +=  (float) (unsigned char) this->heightMapReference->heights[(j -1+ sampleRate   + (i+1)*(this->heightMapReference->heightMap->w ))];
-      height +=  (float)(unsigned char)this->heightMapReference->heights[(j +sampleRate+ (i+2)*(this->heightMapReference->heightMap->w )) ];
-      height +=  (float)(unsigned char)this->heightMapReference->heights[(j+sampleRate + (i)*(this->heightMapReference->heightMap->w )) ];
-      height=height/5.0;
+      height =  (float)(unsigned char)this->heightMapReference->heights[j + sampleRate + i * (this->heightMapReference->heightMap->w)];
+      height += (float)(unsigned char)this->heightMapReference->heights[j + 1 + sampleRate + (i + 1) *
+                                                                        (this->heightMapReference->heightMap->w)];
+      height += (float)(unsigned char)this->heightMapReference->heights[j - 1 + sampleRate + (i + 1) *
+                                                                        (this->heightMapReference->heightMap->w )];
+      height += (float)(unsigned char)this->heightMapReference->heights[j + sampleRate + (i + 2) *
+                                                                        (this->heightMapReference->heightMap->w)];
+      height += (float)(unsigned char)this->heightMapReference->heights[j + sampleRate + i * (this->heightMapReference->heightMap->w)];
+      height /= 5.0;
 
       model->addVertex(scaleX*(this->heightMapReference->heightMap->h -i) + shiftX ,((double)(height)*scaleY) + shiftY ,scaleZ*(j) + shiftZ); // Top Right
@@ -341,4 +346,10 @@
   if(heightMap!=NULL)
   {
+    /*
+        WHAT about following checks:
+    - image size (rectangular?)
+    - image file type (bw?)
+
+    */
 
     PRINTF(0)("loading Image %s\n", height_map_name.c_str());
