Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5980 in orxonox.OLD


Ignore:
Timestamp:
Dec 7, 2005, 9:52:29 PM (18 years ago)
Author:
bottac
Message:

!testing branch height_map!


Please adopt the String on line 46 in file:
branches/height_map/src/world_entities/terrain.cc
according to your setup. The file referred to must be a 8-Bit Bitmap!

Terrain::Terrain (const TiXmlElement* root)
{
Change PATH

HeightMap * hm = new HeightMap("~/svn/data/pictures/heightmapHello.bmp");


Sorry!

Location:
branches/height_map/src
Files:
2 edited

Legend:

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

    r5976 r5980  
    6262  if(heightMap != NULL /* && heightMap->format->BitsPerPixel == 8 */)
    6363        {
    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 ++)
    6666                        {
    67                         for(int j = 0; j < heightMap->w -1;  j += 2)
     67                        for(int j = 0; j < heightMap->w   ;  j += 1)
    6868                        {
    6969
     
    7272                               
    7373                               
    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 ;
    7678                                       
    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);
    7881                        }       
    7982                        }
    8083SDL_UnlockSurface(heightMap);
    81                 for(int i = 0; i < (heightMap->h * heightMap->w)/4   -1  ; i ++)
     84
     85int c = (heightMap->w) / 1;
     86int g = 0;
     87
     88                for(int i = 0; i < (heightMap->w)/1  -1  ; i ++)
    8289                        {
    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 );
    8493                               
    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                                        }
    8697                               
    87 
    88                                 //this->addFace (4 ,VERTEX_ONLY,i,i + (heightMap->w / 2)  ,i + (heightMap->w / 2) +1, i+1 );
     98                       
     99                               
    89100                        }
    90101               
  • branches/height_map/src/world_entities/player.cc

    r5940 r5980  
    277277  /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */
    278278  /* calculate the direction in which the craft is heading  */
    279   Vector direction (1.0, 0.0, 0.0);
     279  Vector direction (20.0, 0.0, 0.0);
    280280  //direction = this->absDirection.apply (direction);
    281281  Vector orthDirection (0.0, 0.0, 1.0);
     
    289289  if( this->bLeft )
    290290  {
    291     accel -=(orthDirection);
     291    accel -=(orthDirection)*20;
    292292    rot +=Vector(1,0,0);
    293293    rotVal -= .4;
     
    295295  if( this->bRight )
    296296  {
    297     accel += orthDirection;
     297    accel += orthDirection*20;
    298298    rot += Vector(1,0,0);
    299299    rotVal += .4;
Note: See TracChangeset for help on using the changeset viewer.