Changeset 7526 in orxonox.OLD for trunk/src/lib
- Timestamp:
- May 3, 2006, 5:49:36 PM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/height_map.cc
r7500 r7526 382 382 HeightMap::~HeightMap() 383 383 { 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 */ 405 414 void HeightMap::init(const std::string& heightMapName) 406 415 { … … 432 441 PRINTF(1)("oops! couldn't load %s for some reason.\n", heightMapName.c_str()); 433 442 434 generateNormalVectorField();443 this->generateNormalVectorField(); 435 444 436 445 this->heights = (unsigned char*)heightMap->pixels; … … 463 472 void HeightMap::draw() const 464 473 { 465 const PNode* camera = State::getCameraNode(); 466 Vector v = camera->getAbsCoor(); 474 Vector v = State::getCameraNode()->getAbsCoor(); 467 475 468 476 int i_min = 0; … … 473 481 474 482 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++) { 479 486 tiles[i][j]->draw(); 480 487 } -
trunk/src/lib/graphics/importer/height_map.h
r7500 r7526 80 80 virtual ~HeightMap(); 81 81 82 void init(const std::string& heightMapName);83 84 82 void setAbsCoor(Vector V); 85 83 float getHeight(float x, float y); … … 95 93 96 94 private: 95 void init(const std::string& heightMapName); 96 97 97 void generateNormalVectorField(); 98 98 void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight );
Note: See TracChangeset
for help on using the changeset viewer.