Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2006, 6:53:35 PM (18 years ago)
Author:
stefalie
Message:

mountain_lake: waterHeight fading works

File:
1 edited

Legend:

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

    r8916 r8918  
    5050  void deactivateRefraction();
    5151
    52 
     52  // slider gui to edit water params during gameplay
    5353  void openGui();
    5454  void closeGui();
    55 
    56 
    5755
    5856  // functions to set parameters for the water, usually they're called through loadparam
    5957  void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); }
    6058  void setWaterPos(float x, float y, float z) { this->waterHeight = y; this->waterVerts[0] = x; this->waterVerts[1] = z; }
     59  void setWaterHeight(float y) { this->waterHeight = y;  }
    6160  void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; }
    6261  void setWaterAngle(float angle) { this->waterAngle = angle; }
    6362  void setWaterColor(float r, float g, float b) { this->waterColor = Vector(r,g,b); }
    64   void setWaterUV(float uv) { this->waterUV = uv; this->bFadeWaterUV = false; }
    65   void setWaterFlow(float flow) { this->waterFlow = flow; this->bFadeWaterFlow = false; }
     63  void setWaterUV(float uv) { this->waterUV = uv; }
     64  void setWaterFlow(float flow) { this->waterFlow = flow; }
    6665  void setNormalMapScale(float scale) { this->kNormalMapScale = scale; }
    67   void setShineSize(float shine) { this->shineSize = shine; this->bFadeShineSize = false; }
    68   void setShineStrength(float strength) { this->shineStrength = strength; this->bFadeShineStrength = false; }
    69   void setReflStrength(float strength) { this->reflStrength = strength; this->bFadeReflStrength = false; }
    70   void setRefraction(float refraction) { this->refraction = refraction; this->bFadeRefraction = false;}
     66  void setShineSize(float shine) { this->shineSize = shine; }
     67  void setShineStrength(float strength) { this->shineStrength = strength; }
     68  void setReflStrength(float strength) { this->reflStrength = strength; }
     69  void setRefraction(float refraction) { this->refraction = refraction; }
    7170
    7271  // functions to change water parameters during runtime
     
    7473  // don't reset kNormalMapScale (because it won't change anything)
    7574  void resetLightPos(float x, float y, float z);
     75  void resetLightPosX(float x) { this->resetLightPos(x, this->lightPos.y, this->lightPos.z); }
     76  void resetLightPosY(float y) { this->resetLightPos(this->lightPos.x, y, this->lightPos.z); }
     77  void resetLightPosZ(float z) { this->resetLightPos(this->lightPos.x, this->lightPos.y, z); }
    7678  void resetWaterPos(float x, float y, float z) { this->setWaterPos(x, y, z); this->calcVerts(); }
    7779  void resetWaterSize(float x, float z) { this->setWaterSize(x, z); this->calcVerts(); }
     
    9395  void fadeReflStrength(float strength, float time) { this->newReflStrength = strength; this->reflStrengthFadeTime = time; this->bFadeReflStrength = true; }
    9496  void fadeRefraction(float refraction, float time) { this->newRefraction = refraction; this->refractionFadeTime = time; this->bFadeRefraction = true; }
     97  void fadeWaterHeight(float y, float time) { this->newWaterHeight = y; this->waterHeightFadeTime = time; this->bFadeWaterHeight = true; }
    9598
    9699private:
     
    101104
    102105private:
    103   Material            mat;
    104   Shader*             shader;
     106  Material                  mat;
     107  Shader*                   shader;
     108  OrxGui::GLGuiBox*         box;
    105109
    106110  // water size and position
    107   float               waterHeight;            //!< position of the water
    108   float               waterVerts[8];          //!< coords of the 4 vertexes of the water quad
    109   float               xWidth, zWidth;         //!< size of the water quad
    110   float               waterAngle;             //!< defines how much the water will be turned around the point waterPos
     111  float                     waterHeight;            //!< position of the water
     112  float                     waterVerts[8];          //!< coords of the 4 vertexes of the water quad
     113  float                     xWidth, zWidth;         //!< size of the water quad
     114  float                     waterAngle;             //!< defines how much the water will be turned around the point waterPos
    111115
    112116  // values for texture size, scale, texture coords
    113   float               move;
    114   float               move2;
    115   float               waterUV;                //!< size of the waves
    116   float               waterFlow;              //!< speed of the water
    117   float               normalUV;
    118   float               kNormalMapScale;
    119   int                 textureSize;            //!< height and width of the texture
     117  float                     move;
     118  float                     move2;
     119  float                     waterUV;                //!< size of the waves
     120  float                     waterFlow;              //!< speed of the water
     121  float                     normalUV;
     122  float                     kNormalMapScale;
     123  int                       textureSize;            //!< height and width of the texture
    120124
    121125  // values for the uniforms
    122   Vector              waterColor;             //!< color of the water
    123   Vector              lightPos;               //!< position of the light that is used to render the reflection
    124   float               shineSize;              //!< the bigger the value, the smaller the specular reflection point
    125   float               shineStrength;
    126   float               reflStrength;
    127   float               refraction;
     126  Vector                    waterColor;             //!< color of the water
     127  Vector                    lightPos;               //!< position of the light that is used to render the reflection
     128  float                     shineSize;              //!< the bigger the value, the smaller the specular reflection point
     129  float                     shineStrength;
     130  float                     reflStrength;
     131  float                     refraction;
    128132
    129133  // uniforms
    130   Shader::Uniform*    cam_uni;                //!< uniform that is used for the camera position
    131   Shader::Uniform*    light_uni;              //!< uniform that is used for the light position
    132   Shader::Uniform*    color_uni;              //!< uniform that is used for the watercolor
    133   Shader::Uniform*    shineSize_uni;          //!< uniform that is used for the specular shininessd of the water
    134   Shader::Uniform*    shineStrength_uni;      //!< uniform that is used for the strenght of the specular reflection
    135   Shader::Uniform*    reflStrength_uni;       //!< uniform that is used for the strength of the reflection
    136   Shader::Uniform*    refr_uni;               //!< uniform that is used for the strength of the refraction
     134  Shader::Uniform*          cam_uni;                //!< uniform that is used for the camera position
     135  Shader::Uniform*          light_uni;              //!< uniform that is used for the light position
     136  Shader::Uniform*          color_uni;              //!< uniform that is used for the watercolor
     137  Shader::Uniform*          shineSize_uni;          //!< uniform that is used for the specular shininessd of the water
     138  Shader::Uniform*          shineStrength_uni;      //!< uniform that is used for the strenght of the specular reflection
     139  Shader::Uniform*          reflStrength_uni;       //!< uniform that is used for the strength of the reflection
     140  Shader::Uniform*          refr_uni;               //!< uniform that is used for the strength of the refraction
    137141
    138142  // fading
    139   tAnimation<MappedWater>*      waterUVFader;
    140   float                         newWaterUV;
    141   float                         waterUVFadeTime;
    142   bool                          bFadeWaterUV ;
    143   tAnimation<MappedWater>*      waterFlowFader;
    144   float                         newWaterFlow;
    145   float                         waterFlowFadeTime;
    146   bool                          bFadeWaterFlow;
    147   tAnimation<MappedWater>*      shineSizeFader;
    148   float                         newShineSize;
    149   float                         shineSizeFadeTime;
    150   bool                          bFadeShineSize;
    151   tAnimation<MappedWater>*      shineStrengthFader;
    152   float                         newShineStrength;
    153   float                         shineStrengthFadeTime;
    154   bool                          bFadeShineStrength;
    155   tAnimation<MappedWater>*      reflStrengthFader;
    156   float                         newReflStrength;
    157   float                         reflStrengthFadeTime;
    158   bool                          bFadeReflStrength;
    159   tAnimation<MappedWater>*      refractionFader;
    160   float                         newRefraction;
    161   float                         refractionFadeTime;
    162   bool                          bFadeRefraction;
    163 
    164   OrxGui::GLGuiBox*             box;
     143  tAnimation<MappedWater>*  waterUVFader;
     144  float                     newWaterUV;
     145  float                     waterUVFadeTime;
     146  bool                      bFadeWaterUV ;
     147  tAnimation<MappedWater>*  waterFlowFader;
     148  float                     newWaterFlow;
     149  float                     waterFlowFadeTime;
     150  bool                      bFadeWaterFlow;
     151  tAnimation<MappedWater>*  shineSizeFader;
     152  float                     newShineSize;
     153  float                     shineSizeFadeTime;
     154  bool                      bFadeShineSize;
     155  tAnimation<MappedWater>*  shineStrengthFader;
     156  float                     newShineStrength;
     157  float                     shineStrengthFadeTime;
     158  bool                      bFadeShineStrength;
     159  tAnimation<MappedWater>*  reflStrengthFader;
     160  float                     newReflStrength;
     161  float                     reflStrengthFadeTime;
     162  bool                      bFadeReflStrength;
     163  tAnimation<MappedWater>*  refractionFader;
     164  float                     newRefraction;
     165  float                     refractionFadeTime;
     166  bool                      bFadeRefraction;
     167  tAnimation<MappedWater>*  waterHeightFader;
     168  float                     newWaterHeight;
     169  float                     waterHeightFadeTime;
     170  bool                      bFadeWaterHeight;
    165171
    166172  int tempcounter;
Note: See TracChangeset for help on using the changeset viewer.