Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2006, 3:55:15 PM (19 years ago)
Author:
stefalie
Message:

mountain_lake: now its possible to set the strength of the specular reflection in the oxw file

File:
1 edited

Legend:

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

    r8859 r8866  
    6161  delete color_uni;
    6262  delete light_uni;
    63   delete shine_uni;
     63  delete shineSize_uni;
     64  delete shineStrength_uni;
     65  delete refr_uni;
    6466}
    6567
     
    7880  this->setNormalMapScale(0.25f);
    7981  this->setWaterColor(0.1f, 0.2f, 0.4f);
    80   this->setShininess(128);
     82  this->setShineSize(128);
     83  this->setShineStrength(0.7);
     84  this->setRefraction(0.009f);
    8185
    8286  // initialization of the texture coords, speeds etc...
     
    151155  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
    152156  // Set the variable "shine"
    153   shine_uni = new Shader::Uniform(shader, "kShine");
    154   shine_uni->set(this->shininess);
     157  shineSize_uni = new Shader::Uniform(shader, "kShine");
     158  shineSize_uni->set(this->shineSize);
     159  // Set the variable "shineStrength"
     160  shineStrength_uni = new Shader::Uniform(shader, "shineStrength");
     161  shineStrength_uni->set(this->shineStrength);
     162  // Set the variable "refraction"
     163  refr_uni = new Shader::Uniform(shader, "kRefraction");
     164  refr_uni->set(this->refraction);
    155165  // uniform for the camera position
    156166  cam_uni = new Shader::Uniform(shader, "cameraPos");
     
    189199
    190200  this->shader->deactivateShader();
    191 };
     201}
    192202
    193203/**
     
    195205 * @param shine new value for the shininess
    196206 */
    197 void MappedWater::resetShininess(float shine)
    198 {
    199   this->shader->activateShader();
    200   this->shininess = shine;
     207void MappedWater::resetShineSize(float shine)
     208{
     209  this->shader->activateShader();
     210  this->shineSize = shine;
    201211
    202212  // Set the variable "shine"
    203   shine_uni->set(this->shininess);
    204 
    205   this->shader->deactivateShader();
    206 };
     213  shineSize_uni->set(this->shineSize);
     214
     215  this->shader->deactivateShader();
     216}
     217
     218/**
     219 * @brief resets the strength of the specular reflection in the Shader
     220 * @param strength new value for the strength of the specular reflection
     221 */
     222void MappedWater::resetShineStrength(float strength)
     223{
     224  this->shader->activateShader();
     225  this->shineStrength = strength;
     226
     227  // Set the variable "shine"
     228  shineStrength_uni->set(this->shineStrength);
     229
     230  this->shader->deactivateShader();
     231}
     232
     233/**
     234 * @brief resets the refraction in the Shader
     235 * @param refraction new value for the refraction
     236 */
     237void MappedWater::resetRefraction(float refraction)
     238{
     239  this->shader->activateShader();
     240  this->refraction = refraction;
     241
     242  // Set the variable "shine"
     243  refr_uni->set(this->refraction);
     244
     245  this->shader->deactivateShader();
     246}
    207247
    208248/**
     
    221261
    222262  this->shader->deactivateShader();
    223 };
     263}
    224264
    225265/**
     
    239279  LoadParam(root, "waterangle", this, MappedWater, setWaterAngle);
    240280  LoadParam(root, "watercolor", this, MappedWater, setWaterColor);
    241   LoadParam(root, "shininess", this, MappedWater, setShininess);
     281  LoadParam(root, "shinesize", this, MappedWater, setShineSize);
     282  LoadParam(root, "shinestrength", this, MappedWater, setShineStrength);
     283  LoadParam(root, "refraction", this, MappedWater, setRefraction);
    242284}
    243285
Note: See TracChangeset for help on using the changeset viewer.