Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5993 in orxonox.OLD


Ignore:
Timestamp:
Dec 8, 2005, 10:30:58 PM (18 years ago)
Author:
bottac
Message:

After fixing a wrong unsigned char to int conversion, HeightMaps look much better now!

https://www.orxonox.net/cgi-bin/trac.cgi/attachment/wiki/HeightMap/screenshot1.jpg?format=raw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/height_map/src/lib/graphics/importer/height_map.cc

    r5991 r5993  
    6060void HeightMap::load()
    6161{
    62  int height = 0;
     62 unsigned char height = 0;
    6363 int offset = 0;
     64
    6465 char *  bmp = (char*) heightMap->pixels;
    6566
     
    6768        {
    6869        SDL_LockSurface(heightMap);
    69         for(int i = 0 ; i < heightMap->h  ; i +=1)
     70        for(int i = 0 ; i < heightMap->h  ; i +=2)
    7071        {
    71             for(int j = 0; j < heightMap->w   ;  j += 1)
     72            for(int j = 0; j < heightMap->w   ;  j += 2)
    7273            {
    7374                // get local hight from heightMap
     
    8081                           heightMap->format->palette->colors[offset].b ; */
    8182                                       
    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);
    8485             } 
    8586        }
    8687        SDL_UnlockSurface(heightMap);
    8788
    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 ++)
    9093        {
    91             for(int j = 0; j < (heightMap->h)/1 - 1; j++)
     94            for(int j = 0; j < (heightMap->h)/2 - 2; j++)
    9295            {
    9396                 
    9497                /* Two Triangles or ...*/
    9598               
    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 );                           
    98101                                 
    99102                /* ... one square*/
    100103
    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 );
    102105            }
    103106                               
Note: See TracChangeset for help on using the changeset viewer.