- Timestamp:
- May 3, 2006, 10:51:16 AM (19 years ago)
- Location:
- trunk/src/lib/graphics/importer
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/height_map.cc
r7499 r7500 141 141 normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z, 142 142 normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x); 143 model->addTexCoor((float)(yOffset-sampleRate) /( texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));143 model->addTexCoor((float)(yOffset-sampleRate) /(HM_TEX_RATE), (float)(i %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 144 144 model->addColor(r/255.0f, g/255.0f, b/255.0f); 145 145 … … 170 170 normalVectorField[i % this->heightMapReference->heightMap->h][j % this->heightMapReference->heightMap->w].z, 171 171 normalVectorField[i % this->heightMapReference->heightMap->h][j % this->heightMapReference->heightMap->w].x); 172 model->addTexCoor((float)(j) /( texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));172 model->addTexCoor((float)(j) /(HM_TEX_RATE), (float)(i %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 173 173 model->addColor(r/255.0f, g/255.0f, b/255.0f); 174 174 //PRINTF(0)("TexCoord: %f %f \n",(float)j / 100.0, (float)(i %this->heightMapReference->h)/100.0); … … 180 180 normalVectorField[i % this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].z, 181 181 normalVectorField[i% this->heightMapReference->heightMap->h][w % this->heightMapReference->heightMap->w].x); 182 model->addTexCoor((float)(j2+sampleRate) /( texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));182 model->addTexCoor((float)(j2+sampleRate) /(HM_TEX_RATE), (float)(i %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 183 183 model->addColor(r/255.0f, g/255.0f, b/255.0f); 184 184 } … … 217 217 normalVectorField[i % this->heightMapReference->heightMap->h][j % this->heightMapReference->heightMap->w].z, 218 218 normalVectorField[i % this->heightMapReference->heightMap->h][j % this->heightMapReference->heightMap->w].x); 219 model->addTexCoor((float)j /( texRate), (float)((i - sampleRate) %this->heightMapReference->heightMap->h)/(texRate));219 model->addTexCoor((float)j /(HM_TEX_RATE), (float)((i - sampleRate) %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 220 220 model->addColor(r/255.0f, g/255.0f, b/255.0f); 221 221 } … … 241 241 normalVectorField[i % this->heightMapReference->heightMap->h][j% this->heightMapReference->heightMap->w].z, 242 242 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].x); 243 model->addTexCoor((float)j /( texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));243 model->addTexCoor((float)j /(HM_TEX_RATE), (float)(i %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 244 244 model->addColor(r/255.0f, g/255.0f, b/255.0f); 245 245 } … … 263 263 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].z, 264 264 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].x); 265 model->addTexCoor((float)j /( texRate), (float)((i+ sampleRate) %this->heightMapReference->heightMap->h)/(texRate));265 model->addTexCoor((float)j /(HM_TEX_RATE), (float)((i+ sampleRate) %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 266 266 model->addColor(r/255.0f, g/255.0f, b/255.0f); 267 267 } … … 286 286 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].z, 287 287 normalVectorField[i%this->heightMapReference->heightMap->h][j%this->heightMapReference->heightMap->w].x); 288 model->addTexCoor((float)j /( texRate), (float)(i %this->heightMapReference->heightMap->h)/(texRate));288 model->addTexCoor((float)j /(HM_TEX_RATE), (float)(i %this->heightMapReference->heightMap->h)/(HM_TEX_RATE)); 289 289 model->addColor(r/255.0f, g/255.0f, b/255.0f); 290 290 } … … 385 385 delete colorMap; 386 386 387 for(int i=0;i < heightMap->h/ tileSize; i++)388 { 389 for(int j = 0; j < heightMap->w/ tileSize; j++)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 390 { 391 391 delete tiles [i][j]; 392 392 } 393 393 } 394 for(int i=0;i < heightMap->h/ tileSize; i++)394 for(int i=0;i < heightMap->h/HM_TILE_SIZE ; i++) 395 395 delete[] tiles[i]; 396 396 delete[] tiles; … … 444 444 { 445 445 // create a dynamicly sized 2D-array for tiles 446 this->tiles = new Tile**[this->heightMap->h / this->tileSize];447 448 for( int i = 0;i < heightMap->h / tileSize; i++)449 this->tiles [i]= new Tile*[this->heightMap->w / this->tileSize];446 this->tiles = new Tile**[this->heightMap->h / HM_TILE_SIZE]; 447 448 for( int i = 0;i < heightMap->h / HM_TILE_SIZE; i++) 449 this->tiles [i]= new Tile*[this->heightMap->w / HM_TILE_SIZE]; 450 450 451 451 // setup arrays 452 for( int i = 0; i < this->heightMap->h / this->tileSize; i++) {453 for( int j = 0; j < this->heightMap->w / this->tileSize; j++) {454 this->tiles[i][j] = new Tile( i * tileSize , j * tileSize , (i+1) * tileSize, (j+1) * tileSize, this);452 for( int i = 0; i < this->heightMap->h / HM_TILE_SIZE; i++) { 453 for( int j = 0; j < this->heightMap->w / HM_TILE_SIZE; j++) { 454 this->tiles[i][j] = new Tile( i * HM_TILE_SIZE , j * HM_TILE_SIZE , (i+1) * HM_TILE_SIZE, (j+1) * HM_TILE_SIZE , this); 455 455 } 456 456 } … … 467 467 468 468 int i_min = 0; 469 int i_max = (heightMap->h )/ tileSize;469 int i_max = (heightMap->h )/ HM_TILE_SIZE; 470 470 int j_min = 0; 471 int j_max= (heightMap->w ) / tileSize;471 int j_max= (heightMap->w ) / HM_TILE_SIZE; 472 472 473 473 -
trunk/src/lib/graphics/importer/height_map.h
r7499 r7500 20 20 21 21 22 #define texRate 32 23 #define texRatef 4.0f 24 #define tileSize 64 22 #define HM_TEX_RATE 32 23 #define HM_TILE_SIZE 64 25 24 26 25 //!< define the LOD level distances. later this could be dynamicaly adjusted
Note: See TracChangeset
for help on using the changeset viewer.