Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8788 in orxonox.OLD


Ignore:
Timestamp:
Jun 26, 2006, 2:33:26 PM (18 years ago)
Author:
stefalie
Message:

water: param reset functions work, the fade functions are next

Location:
branches/water/src/world_entities/environments
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/water/src/world_entities/environments/mapped_water.cc

    r8729 r8788  
    4545  /// initialization of the shaders
    4646  this->initShaders();
     47 
     48  tempcounter = 0;
    4749}
    4850
     
    155157
    156158/**
     159 * @brief resets the waterColor in the Shader
     160 * @param r new value for red
     161 * @param g new value for green
     162 * @param b new value for blue
     163 */
     164void MappedWater::resetWaterColor(float r, float g, float b)
     165{
     166  this->shader->activateShader();
     167  this->waterColor = Vector(r, g, b);
     168
     169  // Give the variable "waterColor" a color
     170  color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
     171
     172  this->shader->deactivateShader();
     173};
     174
     175/**
     176 * @brief resets the shininess in the Shader
     177 * @param shine new value for the shininess
     178 */
     179void MappedWater::resetShininess(float shine)
     180{
     181  this->shader->activateShader();
     182  this->shininess = shine;
     183
     184  // Set the variable "shine"
     185  shine_uni->set(this->shininess);
     186
     187  this->shader->deactivateShader();
     188};
     189
     190/**
     191 * @brief resets the lightPos in the Shader
     192 * @param x new x value
     193 * @param y new y value
     194 * @param z new z value
     195 */
     196void MappedWater::resetLightPos(float x, float y, float z)
     197{
     198  this->shader->activateShader();
     199  this->lightPos = Vector(x, y, z);
     200
     201  // Give the variable "lightPos" our hard coded light position
     202  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
     203
     204  this->shader->deactivateShader();
     205};
     206
     207/**
    157208 * @brief ends the refraction and saves the graphic buffer into a texture
    158209 * @param root xml data
     
    239290  this->move += this->waterFlow * dt;
    240291  this->move2 = this->move * this->kNormalMapScale;
     292 
     293
     294  if(this->tempcounter == 200) {
     295    this->resetWaterColor(1, 0, 0);
     296    resetShininess(1);
     297    resetLightPos(0, 100, 0);
     298    PRINTF(0)("test waterchangecolor ");
     299    }
     300  tempcounter++;
     301   
    241302}
    242303
  • branches/water/src/world_entities/environments/mapped_water.h

    r8729 r8788  
    5454  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); };
    5555
     56  // functions to change water parameters during runtime
     57  // to reset waterUV and waterFlow just use the normal set functions
     58  void resetWaterColor(float r, float g, float b);
     59  void resetShininess(float shine);
     60  void resetLightPos(float x, float y, float z);
     61
    5662private:
    5763  void initParams();
     
    8086  Shader::Uniform*    color_uni;              //!< uniform that is used for the watercolor
    8187  Shader::Uniform*    shine_uni;              //!< uniform that is used for the specular shininessd of the water
     88 
     89 
     90  int tempcounter;
    8291};
    8392
Note: See TracChangeset for help on using the changeset viewer.