float TerrainController::getHeight(const TerrainPoint& p) const
{
	unsigned x = (unsigned)(((float)p.col / width) * heightmapDesc.Width);
	unsigned y = (unsigned)(((float)(length - p.row) / length) * heightmapDesc.Height);

	return getHeightmapData(x, y);
}
void Terrain::makeTexture()
{
  int width = 1025;
  int height = width;
  float* heights = getHeightmapData(width,height);
  heightmapTexture = new Texture(HEIGHTMAP_TEXTURE,width,height);
  heightmapTexture->loadBumpData(heights);
  heightmapTexture->load();
  heightmapTexture->toTGA("heightmap.tga");
}