Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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/world_entities/environments/water.cc

    r6457 r6458  
    3434
    3535  this->resX = this->resY = 10;
    36   this->sizeX = this->sizeY = 1.0;
     36  this->sizeX = this->sizeY = 1.0f;
     37  this->height = 0.5f;
    3738  this->grid = NULL;
    3839
     
    6162      .describe("sets the resolution of the water surface")
    6263      .defaultValues(2, 10, 10);
     64
     65  LoadParam(root, "height", this, Water, setHeight)
     66      .describe("the height of the Waves")
     67      .defaultValues(1, 0.5f);
    6368}
    6469
     
    6974  this->grid = new Grid(this->sizeX, this->sizeY, this->resX, this->resY);
    7075
    71   this->grid->debug();
    7276  this->setModel(this->grid, 0);
    7377}
     
    8589}
    8690
     91void Water::setHeight(float height)
     92{
     93  this->height = height;
     94}
     95
     96
    8797void Water::draw() const
    8898{
     
    98108    for (unsigned int j = 0; j < this->grid->columns(); j++)
    99109    {
    100       this->grid->height(i,j) = 15.0*sin(((float)i/(float)this->grid->rows() *phase)+
    101           15*cos((float)j/(float)this->grid->columns()) * phase);
     110      this->grid->height(i,j) = this->height*sin(((float)i/(float)this->grid->rows() *phase)+
     111          this->height*cos((float)j/(float)this->grid->columns()) * phase);
    102112    }
    103113  }
     114  this->grid->rebuildNormals(this->height);
    104115}
Note: See TracChangeset for help on using the changeset viewer.