Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

trunk: better smoother water

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.