Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6603 in orxonox.OLD


Ignore:
Timestamp:
Jan 18, 2006, 5:45:24 PM (18 years ago)
Author:
bottac
Message:

Improved texturemapping

Location:
branches/height_map_merge/src
Files:
5 edited

Legend:

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

    r6579 r6603  
    5454void Tile::draw()
    5555{
    56  lowResModel->draw();
     56         // This Draws the LOD's
     57                                                                //FIXME
     58    float cameraDistance = (State::getCamera()->getAbsCoor() - Vector(0.0,100.0,0.0)).len();
     59    if (cameraDistance > 5000 )
     60    {
     61   
     62    }
     63    else if (cameraDistance > 1000 )
     64    {
     65      this->drawLowRes();
     66    }
     67    else
     68    {
     69      this->drawHighRes();
     70    }
    5771}
    5872
     
    432446int j_max= (heightMap->w - tileSize) / tileSize;
    433447
    434 // calc i_min , i_max j_min and j_maxt
    435 
    436 int centerX =  (int)((heightMap->h - ((v.x - shiftX)/ (float)scaleX ))/ tileSize);
    437 int  centerY = (int)((v.z - shiftZ)/ (float)scaleZ )/ tileSize;
    438 //PRINTF(0)("i_max %i \n" , i_max);
    439 //PRINTF(0)("CENTERY %i \n ",centerY );
    440 i_min = max(centerX  -1, i_min);
    441 i_max = min(centerX +2 , i_max );
    442 
    443 j_min = max(centerY -1,1);
    444 j_max = min(centerY +2, j_max);
    445 
    446 
    447 for(int i = 1; i <  i_min        ; i ++)
     448
     449
     450for(int i = 1; i <  i_max        ; i ++)
    448451{
    449452        for(int j = 1; j < j_max ; j++)
    450453        {
    451454               
    452          tiles[i][j]->drawLowRes();
     455         tiles[i][j]->draw();
    453456        }       
    454457}
    455 for(int i = i_min; i <  i_max    ; i ++)
    456 {
    457         for(int j = j_min; j < j_max ; j++)
    458         {
    459                
    460          tiles[i][j]->drawHighRes();
    461         }       
    462 }
    463 
    464 for(int i = i_max; i <  (heightMap->h -tileSize)/tileSize        ; i ++)
    465 {
    466         for(int j = 1; j < j_max ; j++)
    467         {
    468                
    469          tiles[i][j]->drawLowRes();
    470         }       
    471 }
    472 
    473 
    474 for(int i = 1; i < (heightMap->h -tileSize)/tileSize; i++ )
    475 {
    476         for(int j = 1; j < j_min; j++)
    477         {
    478          tiles[i][j]->drawLowRes();
    479         }
    480 }
    481 for(int i = 1; i < (heightMap->h -tileSize)/tileSize; i++)
    482 {
    483         for(int j = j_max; j < (heightMap->w -tileSize)/tileSize; j++ )
    484         {
    485         tiles[i][j]->drawLowRes();
    486         }
    487 }
    488458
    489459}
  • branches/height_map_merge/src/lib/graphics/importer/height_map.h

    r6579 r6603  
    1717
    1818
    19 #define texRate      22
     19#define texRate      64
    2020#define texRatef     4.0f
    21 #define tileSize     32
     21#define tileSize     64
    2222
    2323class SDL_Surface;
  • branches/height_map_merge/src/lib/graphics/importer/texture.cc

    r6465 r6603  
    264264
    265265
    266   glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
    267   glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
     266  // glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_REPEAT);
     267  // glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_REPEAT);
    268268
    269269  /* control the mipmap levels */
  • branches/height_map_merge/src/lib/graphics/importer/vertex_array_model.cc

    r6477 r6603  
    135135void VertexArrayModel::draw() const
    136136{
     137
     138  glPushAttrib(GL_ALL_ATTRIB_BITS);
     139  glColorMaterial ( GL_FRONT_AND_BACK, GL_EMISSION ) ;
     140  glEnable (GL_COLOR_MATERIAL) ;
     141
     142
    137143  PRINTF(4)("drawing 3D-VertexArrayModel %s\n", this->getName());
     144 
    138145  glEnableClientState(GL_VERTEX_ARRAY );
    139   //glEnableClientState(GL_TEXTURE_COORD_ARRAY );
     146  glEnableClientState(GL_TEXTURE_COORD_ARRAY );
    140147  glEnableClientState(GL_NORMAL_ARRAY );
    141148  glEnableClientState(GL_COLOR_ARRAY );
     
    144151  glVertexPointer(3, GL_FLOAT, 0, &this->vertices[0]);
    145152  glNormalPointer(GL_FLOAT, 0, &this->normals[0]);
    146   //glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
     153  glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
    147154  glColorPointer(3, GL_FLOAT, 0, &this->colors[0]);
     155
     156 
     157
    148158
    149159  for (GLuint i = 1; i < this->stripes.size(); ++i)
     
    154164                      &this->indices[this->stripes[i-1]] );
    155165    }
     166
     167        glPopAttrib();
    156168}
    157169
  • branches/height_map_merge/src/world_entities/terrain.cc

    r6579 r6603  
    167167  if (this->heightMapMaterial != NULL)
    168168    delete this->heightMapMaterial;
     169
     170
     171   this->heightMapMaterial = new Material();
     172   heightMapMaterial->setTransparency(1.0);
     173   heightMapMaterial->setIllum(0.2);
     174
     175   heightMapMaterial->setDiffuse(1.0,1.0,1.0);
     176   heightMapMaterial->setAmbient(1.0,1.0,1.0 );
     177   heightMapMaterial->setSpecular(1.0,1.0,1.0);
     178   heightMapMaterial->setShininess(.5);
     179   heightMapMaterial->setTransparency(1.0);
     180
     181   heightMapMaterial->diffuseTexture = NULL;
     182   heightMapMaterial->ambientTexture = NULL;
     183   heightMapMaterial->specularTexture = NULL;
     184 
     185   
     186   heightMapMaterial->setDiffuseMap(textureName);
     187   heightMapMaterial->setAmbientMap(textureName);
     188   heightMapMaterial->setSpecularMap(textureName);     
     189 
     190
     191
    169192}
    170193
     
    212235        {
    213236        this->heightMapMaterial->select();
    214        
     237        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
     238        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    215239   
    216         // glEnable(GL_LIGHTING);
     240        glEnable(GL_LIGHTING);
    217241        glColorMaterial ( GL_FRONT_AND_BACK, GL_EMISSION ) ;
    218242        glEnable (GL_COLOR_MATERIAL) ;
Note: See TracChangeset for help on using the changeset viewer.