Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6458 in orxonox.OLD for trunk/src/lib/graphics/importer/grid.cc


Ignore:
Timestamp:
Jan 10, 2006, 1:20:12 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: wave now also rebuilds the Normals (do not know if this is really necesarry, but i sure hope so for all the work :)

File:
1 edited

Legend:

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

    r6454 r6458  
    3333  this->_sizeX = sizeX;
    3434  this->_sizeY = sizeY;
     35  this->_gridSpacingX = sizeX / rows;
     36  this->_gridSpacingY = sizeY / columns;
    3537}
    3638
     
    4345  // delete what has to be deleted here
    4446}
     47
     48
     49void Grid::rebuildNormals(float maxHeight)
     50{
     51  for (unsigned int i = 1; i < this->_rows-1; i++)
     52  {
     53    for (unsigned int j = 1; j < this->_columns-1; j++)
     54    {
     55     Vector test(
     56          (this->vertex(i*_columns+j).y + this->vertex((i-1)*_columns+j).y - this->vertex((i+1)*_columns+j).y ) /maxHeight,
     57          1.0,
     58          (this->vertex(i*_columns+j).y - this->vertex(i*_columns+j-1).y + this->vertex(i*_columns+j+1).y)/maxHeight
     59                );
     60      this->normal( i*_columns+j) = test.getNormalized();
     61    }
     62
     63  }
     64
     65}
Note: See TracChangeset for help on using the changeset viewer.