Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7526 in orxonox.OLD for trunk/src


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

orxonox: work flush on hm

Location:
trunk/src/lib/graphics/importer
Files:
2 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    }
  • trunk/src/lib/graphics/importer/height_map.h

    r7500 r7526  
    8080    virtual ~HeightMap();
    8181
    82     void init(const std::string& heightMapName);
    83 
    8482    void setAbsCoor(Vector V);
    8583    float getHeight(float x, float y);
     
    9593
    9694  private:
     95    void init(const std::string& heightMapName);
     96
    9797    void generateNormalVectorField();
    9898    void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight );
Note: See TracChangeset for help on using the changeset viewer.