Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6519 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 18, 2006, 12:38:19 AM (19 years ago)
Author:
bensch
Message:

trunk: better smoother water

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/grid.h

    r6518 r6519  
    2828
    2929  float& height(unsigned int row, unsigned int column) { return this->vertex(row*this->_columns + column).y;};
     30  Vector& vertexG(unsigned int row, unsigned int column) { return this->vertex(row*this->_columns + column); };
     31  Vector& normalG(unsigned int row, unsigned int column) { return this->normal(row*this->_columns + column); };
    3032
    3133
  • trunk/src/lib/graphics/importer/vertex_array_model.cc

    r6477 r6519  
    137137  PRINTF(4)("drawing 3D-VertexArrayModel %s\n", this->getName());
    138138  glEnableClientState(GL_VERTEX_ARRAY );
    139   //glEnableClientState(GL_TEXTURE_COORD_ARRAY );
     139  glEnableClientState(GL_TEXTURE_COORD_ARRAY );
    140140  glEnableClientState(GL_NORMAL_ARRAY );
    141141  glEnableClientState(GL_COLOR_ARRAY );
     
    144144  glVertexPointer(3, GL_FLOAT, 0, &this->vertices[0]);
    145145  glNormalPointer(GL_FLOAT, 0, &this->normals[0]);
    146   //glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
     146  glTexCoordPointer(2, GL_FLOAT, 0, &this->texCoords[0]);
    147147  glColorPointer(3, GL_FLOAT, 0, &this->colors[0]);
    148148
  • trunk/src/world_entities/environments/water.cc

    r6518 r6519  
    4646  this->velocities = NULL;
    4747  this->viscosity = 5;
    48   this->cohesion = .00002;
     48  this->cohesion = .00000001;
    4949
    5050  if (root != NULL)
     
    5555  this->waterShader = (Shader*)ResourceManager::getInstance()->load("shaders/water.vert", SHADER, RP_GAME, (void*)"shaders/water.frag");
    5656
    57   this->grid->height(this->grid->columns()/2,this->grid->rows()/2) = 1000;
     57  this->grid->height(this->grid->columns()/2,this->grid->rows()/2) = 100;
    5858}
    5959
     
    185185
    186186  // calc normals
    187 /*  float l[3];
    188   float m[3];
    189   for(j = 1; j < _width-1; j++) {
    190     for(i = 1; i < _width - 1; i++) {
    191       l[0] = _map[i][j-1].u[0] - _map[i][j+1].u[0];
    192       l[1] = _map[i][j-1].u[1] - _map[i][j+1].u[1];
    193       l[2] = _map[i][j-1].u[2] - _map[i][j+1].u[2];
    194       m[0] = _map[i-1][j].u[0] - _map[i+1][j].u[0];
    195       m[1] = _map[i-1][j].u[1] - _map[i+1][j].u[1];
    196       m[2] = _map[i-1][j].u[2] - _map[i+1][j].u[2];
    197       _map[i][j].n[0] = l[1]*m[2]-l[2]*m[1];
    198       _map[i][j].n[1] = l[2]*m[0]-l[0]*m[2];
    199       _map[i][j].n[2] = l[0]*m[1]-l[1]*m[0];
    200     }
    201   }*/
    202 }
     187//   float l[3];
     188//   float m[3];
     189//   for(j = 1; j < this->grid->rows() -1; j++) {
     190//     for(i = 1; i < this->grid->columns() - 1; i++) {
     191//       l[0] = this->grid->vertexG(i, j-1).x - this->grid->vertexG(i, j+1).x;
     192//       l[1] = this->grid->vertexG(i, j-1).y - this->grid->vertexG(i, j+1).y;
     193//       l[2] = this->grid->vertexG(i, j-1).z - this->grid->vertexG(i, j+1).z;
     194//       m[0] = this->grid->vertexG(i-1,j).x - this->grid->vertexG(i+1, j).x;
     195//       m[1] = this->grid->vertexG(i-1,j).y - this->grid->vertexG(i+1, j).y;
     196//       m[2] = this->grid->vertexG(i-1,j).z - this->grid->vertexG(i+1, j).z;
     197//       this->grid->normalG(i, j).x = l[1] * m[2] - l[2] * m[1];
     198//       this->grid->normalG(i, j).y = l[2] * m[0] - l[0] * m[2];
     199//       this->grid->normalG(i, j).z = l[0] * m[1] - l[1] * m[0];
     200//     }
     201//   }
     202  this->grid->rebuildNormals(this->height);
     203}
  • trunk/src/world_entities/skybox.cc

    r6512 r6519  
    8181      this->material[i]->setAmbient(2.0, 2.0, 2.0);
    8282
    83       this->texture[i] = NULL;
     83      this->cubeTexture[i] = NULL;
    8484    }
    8585  this->setParentMode(PNODE_MOVEMENT);
     
    166166                                  const char* right, const char* front, const char* back)
    167167{
    168   this->texture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB);
    169   this->texture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB);
    170   this->texture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
    171   this->texture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB);
    172   this->texture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB);
    173   this->texture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB);
     168  this->cubeTexture[0] = new Texture (top, GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB);
     169  this->cubeTexture[1] = new Texture (bottom, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB);
     170  this->cubeTexture[2] = new Texture (left, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB);
     171  this->cubeTexture[3] = new Texture (right, GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB);
     172  this->cubeTexture[4] = new Texture (front, GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB);
     173  this->cubeTexture[5] = new Texture (back, GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB);
    174174}
    175175
     
    177177{
    178178  glEnable(GL_TEXTURE_CUBE_MAP_ARB);
     179  glEnable(GL_TEXTURE_2D);
    179180  glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
    180181  glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_ARB);
     
    188189{
    189190  glDisable(GL_TEXTURE_CUBE_MAP_ARB);
     191  glDisable(GL_TEXTURE_2D);
    190192  glDisable(GL_TEXTURE_GEN_S);
    191193  glDisable(GL_TEXTURE_GEN_T);
  • trunk/src/world_entities/skybox.h

    r6512 r6519  
    5757
    5858  Material*       material[6];     //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
    59   Texture*        texture[6];      //!< Textures for the CubeMap.
     59  Texture*        cubeTexture[6];  //!< Textures for the CubeMap.
    6060
    6161  float           size;            //!< Size of the SkyBox. This should match the frustum maximum range.
Note: See TracChangeset for help on using the changeset viewer.