Changeset 5993 in orxonox.OLD for branches/height_map/src
- Timestamp:
- Dec 8, 2005, 10:30:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/height_map/src/lib/graphics/importer/height_map.cc
r5991 r5993 60 60 void HeightMap::load() 61 61 { 62 intheight = 0;62 unsigned char height = 0; 63 63 int offset = 0; 64 64 65 char * bmp = (char*) heightMap->pixels; 65 66 … … 67 68 { 68 69 SDL_LockSurface(heightMap); 69 for(int i = 0 ; i < heightMap->h ; i += 1)70 for(int i = 0 ; i < heightMap->h ; i +=2) 70 71 { 71 for(int j = 0; j < heightMap->w ; j += 1)72 for(int j = 0; j < heightMap->w ; j += 2) 72 73 { 73 74 // get local hight from heightMap … … 80 81 heightMap->format->palette->colors[offset].b ; */ 81 82 82 83 this->addVertex( 20*(heightMap->h - i) , ((double)( (double)300-40*height)/100) - 300 ,20*j);83 84 this->addVertex( 12*(heightMap->h - i) , (( (double)height)/4)-200 ,12 *j); 84 85 } 85 86 } 86 87 SDL_UnlockSurface(heightMap); 87 88 88 int c = (heightMap->w) ; // One line 89 for(int i = 0; i < (heightMap->w) -1 ; i += 1) 89 90 91 int c = (heightMap->w)/2 ; // One line 92 for(int i = 0; i < (heightMap->w)/2 -2 ; i ++) 90 93 { 91 for(int j = 0; j < (heightMap->h)/ 1 - 1; j++)94 for(int j = 0; j < (heightMap->h)/2 - 2; j++) 92 95 { 93 96 94 97 /* Two Triangles or ...*/ 95 98 96 //this->addFace (3, VERTEX_ONLY,j+1+i*c ,j + (i+1)*c, j + i*c );97 //this->addFace (3, VERTEX_ONLY,j + (i+1)*c +1 ,j + (i+1)*c,j+i*c +1 );99 this->addFace (3, VERTEX_ONLY,j + (i+1)*c,j+1+i*c , j + i*c ); 100 this->addFace (3, VERTEX_ONLY,j + (i+1)*c,j + (i+1)*c +1 ,j+i*c +1 ); 98 101 99 102 /* ... one square*/ 100 103 101 this->addFace (4 ,VERTEX_ONLY,j+i*c,j+(i+1)*c ,j + (i+1)*c +1, j +i*c+1 );104 //this->addFace (4 ,VERTEX_ONLY,j+i*c,j+(i+1)*c ,j + (i+1)*c +1, j +i*c+1 ); 102 105 } 103 106
Note: See TracChangeset
for help on using the changeset viewer.