Changeset 5980 in orxonox.OLD for branches/height_map/src/lib/graphics
- Timestamp:
- Dec 7, 2005, 9:52:29 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/height_map/src/lib/graphics/importer/height_map.cc
r5976 r5980 62 62 if(heightMap != NULL /* && heightMap->format->BitsPerPixel == 8 */) 63 63 { 64 SDL_LockSurface(heightMap);65 for(int i = 0 ; i < heightMap->h -1; i += 2)64 SDL_LockSurface(heightMap); 65 for(int i = 0 ; i < heightMap->h ; i ++) 66 66 { 67 for(int j = 0; j < heightMap->w -1; j += 2)67 for(int j = 0; j < heightMap->w ; j += 1) 68 68 { 69 69 … … 72 72 73 73 74 offset = bmp[j + i*heightMap->w]; 75 height = heightMap->format->palette->colors[offset].r + heightMap->format->palette->colors[offset].g + heightMap->format->palette->colors[offset].b ; 74 offset = bmp[j + i*(heightMap->w )]; 75 height = (unsigned int)heightMap->format->palette->colors[offset].r + 76 (unsigned int)heightMap->format->palette->colors[offset].g + 77 (unsigned int) heightMap->format->palette->colors[offset].b ; 76 78 77 this->addVertex(heightMap->h - i , ((long)( height) / 30) - 60 ,heightMap->w - j); 79 80 this->addVertex( 10*(heightMap->h - i) , (( height)/15) - 200 ,10*j); 78 81 } 79 82 } 80 83 SDL_UnlockSurface(heightMap); 81 for(int i = 0; i < (heightMap->h * heightMap->w)/4 -1 ; i ++) 84 85 int c = (heightMap->w) / 1; 86 int g = 0; 87 88 for(int i = 0; i < (heightMap->w)/1 -1 ; i ++) 82 89 { 83 this->addFace (3, VERTEX_ONLY, i,i+1 ,i + (heightMap->w / 2) ); 90 for(int j = 0; j < (heightMap->h)/1 - 1; j++) 91 { 92 //this->addFace (3, VERTEX_ONLY,j+1+i*c ,j + (i+1)*c, j + i*c ); 84 93 85 this->addFace (3, VERTEX_ONLY,i + (heightMap->w / 2) ,i + (heightMap->w / 2) +1, i+1 ); 94 //this->addFace (3, VERTEX_ONLY,j + (i+1)*c +1 ,j + (i+1)*c,j+i*c +1 ); 95 this->addFace (4 ,VERTEX_ONLY,j+i*c,j+(i+1)*c ,j + (i+1)*c +1, j +i*c+1 ); 96 } 86 97 87 88 //this->addFace (4 ,VERTEX_ONLY,i,i + (heightMap->w / 2) ,i + (heightMap->w / 2) +1, i+1 );98 99 89 100 } 90 101
Note: See TracChangeset
for help on using the changeset viewer.