Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8866 in orxonox.OLD for branches/mountain_lake/src


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

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

Location:
branches/mountain_lake/src/world_entities/environments
Files:
2 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
  • branches/mountain_lake/src/world_entities/environments/mapped_water.h

    r8859 r8866  
    1212  <waterangle>0</waterangle>
    1313  <normalmapscale>0.25</normalmapscale><!-- you won't see a big differnce if you change that -->
    14   <shininess>128</shininess><!-- the bigger the value, the smaller the specular reflection point -->
     14  <shineSize>128</shineSize><!-- the bigger the value, the smaller the specular reflection point -->
     15  <shineStrength>0.7</shineStrength>
     16  <refraction>0.009</refraction>
    1517  <watercolor>0.1, 0.2, 0.4</watercolor>
    1618</MappedWater>
     
    5153  void setWaterFlow(float flow) { this->waterFlow = flow; };
    5254  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; }
    53   void setShininess(float shine) { this->shininess = shine; }
     55  void setShineSize(float shine) { this->shineSize = shine; }
     56  void setShineStrength(float strength) { this->shineStrength = strength; }
     57  void setRefraction(float refraction) { this->refraction = refraction; }
    5458  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); this->newWaterColor = this->waterColor; }
    5559
     
    5761  // to reset waterUV and waterFlow just use the normal set functions
    5862  void resetWaterColor(float r, float g, float b);
    59   void resetShininess(float shine);
     63  void resetShineSize(float shine);
     64  void resetShineStrength(float strength);
     65  void resetRefraction(float refraction);
    6066  void resetLightPos(float x, float y, float z);
    6167  void resetWaterPos(float x, float y, float z) { this->setWaterPos(x, y, z); this->calcVerts(); }
     
    8894  float               normalUV;
    8995  float               kNormalMapScale;
    90   float               shininess;              //!< the bigger the value, the smaller the specular reflection point
     96  float               shineSize;              //!< the bigger the value, the smaller the specular reflection point
     97  float               shineStrength;
     98  float               refraction;
    9199
    92100  int                 textureSize;            //!< height and width of the texture
     
    96104  Shader::Uniform*    light_uni;              //!< uniform that is used for the light position
    97105  Shader::Uniform*    color_uni;              //!< uniform that is used for the watercolor
    98   Shader::Uniform*    shine_uni;              //!< uniform that is used for the specular shininessd of the water
    99 
     106  Shader::Uniform*    shineSize_uni;          //!< uniform that is used for the specular shininessd of the water
     107  Shader::Uniform*    shineStrength_uni;      //!< uniform that is used for the strenght of the specular reflection
     108  Shader::Uniform*    refr_uni;               //!< uniform that is used for the strength of the refraction
    100109
    101110
Note: See TracChangeset for help on using the changeset viewer.