Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8729 in orxonox.OLD


Ignore:
Timestamp:
Jun 22, 2006, 3:49:22 PM (18 years ago)
Author:
stefalie
Message:

water: quite everything works…

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

Legend:

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

    r8719 r8729  
    1919#include "util/loading/resource_manager.h"
    2020#include "state.h"
     21#include "math.h"
    2122
    2223
     
    5354  delete shader;
    5455  delete cam_uni;
     56  delete color_uni;
     57  delete light_uni;
     58  delete shine_uni;
    5559}
    5660
     
    6872  this->setWaterAngle(0);
    6973  this->setNormalMapScale(0.25f);
     74  this->setWaterColor(0.1f, 0.2f, 0.4f);
     75  this->setShininess(128);
    7076
    7177  // initialization of the texture coords, speeds etc...
     
    7581  this->move = 0;
    7682  this->move2 = this->move * this->kNormalMapScale;
     83
     84
    7785}
    7886
     
    132140  Shader::Uniform(shader, "depthMap").set(2);
    133141  // Give the variable "waterColor" a blue color
    134   Shader::Uniform(shader, "waterColor").set(0.1f, 0.2f, 0.4f, 1.0f);
     142  color_uni = new Shader::Uniform(shader, "waterColor");
     143  color_uni->set(waterColor.x, waterColor.y, waterColor.z, 1.0f);
    135144  // Give the variable "lightPos" our hard coded light position
    136   Shader::Uniform(shader, "lightPos").set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
     145  light_uni = new Shader::Uniform(shader, "lightPos");
     146  light_uni->set(lightPos.x, lightPos.y, lightPos.z, 1.0f);
     147  // Set the variable "shine"
     148  shine_uni = new Shader::Uniform(shader, "kShine");
     149  shine_uni->set(this->shininess);
    137150  // uniform for the camera position
    138151  cam_uni = new Shader::Uniform(shader, "cameraPos");
     
    156169  LoadParam(root, "normalmapscale", this, MappedWater, setNormalMapScale);
    157170  LoadParam(root, "waterangle", this, MappedWater, setWaterAngle);
     171  LoadParam(root, "watercolor", this, MappedWater, setWaterColor);
     172  LoadParam(root, "shininess", this, MappedWater, setShininess);
    158173}
    159174
  • branches/water/src/world_entities/environments/mapped_water.h

    r8719 r8729  
    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 -->
     15  <watercolor>0.1, 0.2, 0.4</watercolor>
    1416</MappedWater>
    1517*/
     
    4951  void setWaterFlow(float flow) { this->waterFlow = flow; };
    5052  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; };
     53  void setShininess(float shine) { this->shininess = shine; };
     54  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); };
    5155
    5256private:
     
    6064  Vector              lightPos;               //!< position of the light that is used to render the reflection
    6165  float               waterAngle;             //!< defines how much the water will be turned around the point waterPos
    62 
     66  Vector              waterColor;             //!< color of the water
    6367  float               move;                   //!< textures coords, speeds, positions for the shaded textures....
    6468  float               move2;
     
    6771  float               normalUV;
    6872  float               kNormalMapScale;
     73  float               shininess;              //!< the bigger the value, the smaller the specular reflection point
    6974
    7075  int                 textureSize;            //!< height and width of the texture
     
    7277  Shader*             shader;
    7378  Shader::Uniform*    cam_uni;                //!< uniform that is used for the camera position
     79  Shader::Uniform*    light_uni;              //!< uniform that is used for the light position
     80  Shader::Uniform*    color_uni;              //!< uniform that is used for the watercolor
     81  Shader::Uniform*    shine_uni;              //!< uniform that is used for the specular shininessd of the water
    7482};
    7583
Note: See TracChangeset for help on using the changeset viewer.