Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2006, 5:49:36 PM (18 years ago)
Author:
patrick
Message:

orxonox: work flush on hm

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/height_map.cc

    r7500 r7526  
    382382HeightMap::~HeightMap()
    383383{
    384   delete heightMap;
    385   delete colorMap;
    386 
    387   for(int i=0;i <    heightMap->h/HM_TILE_SIZE ; i++)
    388   {
    389     for(int j = 0; j < heightMap->w/ HM_TILE_SIZE; j++)
    390     {
    391       delete tiles [i][j];
    392     }
    393   }
    394   for(int i=0;i <    heightMap->h/HM_TILE_SIZE ; i++)
    395     delete[] tiles[i];
    396   delete[] tiles;
    397 
    398   for(int i=0;i<heightMap->h;i++)
    399     delete[] normalVectorField [i];
    400   delete[] normalVectorField;
    401 }
    402 
    403 
    404 
     384  if( heightMap)
     385    delete heightMap;
     386  if( colorMap)
     387    delete colorMap;
     388
     389  if( this->tiles)
     390  {
     391    for( int i = 0; i < heightMap->h / HM_TILE_SIZE; i++) {
     392      for( int j = 0; j < heightMap->w / HM_TILE_SIZE; j++) {
     393        delete tiles [i][j];
     394      }
     395    }
     396
     397    for( int i = 0; i < heightMap->h / HM_TILE_SIZE; i++)
     398      delete[] tiles[i];
     399    delete[] tiles;
     400  }
     401
     402  if( this->normalVectorField)
     403  {
     404    for(int i = 0; i < heightMap->h; i++)
     405      delete[] normalVectorField[i];
     406    delete[] normalVectorField;
     407  }
     408}
     409
     410
     411/**
     412 * this is the init function with stuff shared between all constructors
     413 */
    405414void HeightMap::init(const std::string& heightMapName)
    406415{
     
    432441    PRINTF(1)("oops! couldn't load %s for some reason.\n", heightMapName.c_str());
    433442
    434   generateNormalVectorField();
     443  this->generateNormalVectorField();
    435444
    436445  this->heights = (unsigned char*)heightMap->pixels;
     
    463472void HeightMap::draw() const
    464473{
    465   const PNode* camera = State::getCameraNode();
    466   Vector v = camera->getAbsCoor();
     474  Vector v = State::getCameraNode()->getAbsCoor();
    467475
    468476  int i_min = 0;
     
    473481
    474482
    475   for(int i = 0; i <  i_max        ; i ++)
    476   {
    477     for(int j = 0; j < j_max ; j++)
    478     {
     483  /* process the draw command to the tiles, FIXME: think of something more efficient*/
     484  for( int i = 0; i < i_max; i++)  {
     485    for( int j = 0; j < j_max; j++)  {
    479486      tiles[i][j]->draw();
    480487    }
Note: See TracChangeset for help on using the changeset viewer.