Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8828 in orxonox.OLD for branches/mountain_lake/src/world_entities


Ignore:
Timestamp:
Jun 27, 2006, 3:01:54 PM (18 years ago)
Author:
stefalie
Message:

mountain_lake: some fading hacks… doesnt work at all… yet

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

    r8821 r8828  
    292292 
    293293
    294 //   if(this->tempcounter == 200) {
     294//   if(this->tempcounter == 100) {
    295295//     this->resetWaterColor(1, 0, 0);
    296296//     resetShininess(1);
     
    299299//     }
    300300//   tempcounter++;
     301
     302  if(this->tempcounter == 10) {
     303    this->fadeWaterColor(1, 0, 0, 10);
     304
     305    PRINTF(0)("test waterchangecolor ");
     306    }
     307  tempcounter++;
     308
     309  if(this->newWaterColor != this->waterColor)
     310  {
     311    float time = this->colorFadeTime / dt;
     312    float x = (this->newWaterColor.x - this->waterColor.x) * time +this->waterColor.x;
     313    float y = (this->newWaterColor.y - this->waterColor.y) * time +this->waterColor.y;
     314    float z = (this->newWaterColor.z - this->waterColor.z) * time +this->waterColor.z;
     315
     316    this->colorFadeTime -= dt;
     317    this->resetWaterColor(x, y, z);
     318  }
    301319   
    302320}
  • branches/mountain_lake/src/world_entities/environments/mapped_water.h

    r8792 r8828  
    4444
    4545  // functions to set parameters for the water, usually they're called through loadparam
    46   void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); };
    47   void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); };
    48   void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; };
    49   void setWaterAngle(float angle) { this->waterAngle = angle; };
    50   void setWaterUV(float uv) { this->waterUV = uv; };
     46  void setLightPos(float x, float y, float z) { this->lightPos = Vector(x,y,z); }
     47  void setWaterPos(float x, float y, float z) { this->waterPos = Vector(x,y,z); }
     48  void setWaterSize(float x, float z) { this->xWidth = x; this->zWidth = z; }
     49  void setWaterAngle(float angle) { this->waterAngle = angle; }
     50  void setWaterUV(float uv) { this->waterUV = uv; }
    5151  void setWaterFlow(float flow) { this->waterFlow = flow; };
    52   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); };
     52  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); this->newWaterColor = this->waterColor; }
    5555
    5656  // functions to change water parameters during runtime
     
    6161
    6262  // fade functions
    63   void fadeWaterColor(float r, float g, float b, float time);
     63  void fadeWaterColor(float r, float g, float b, float time) {this->newWaterColor = Vector(r, g, b); this->colorFadeTime = time; }
    6464  void fadeShininess(float shine, float time);
    6565  void fadeLightPos(float x, float y, float z, float time);
     
    7676  float               waterAngle;             //!< defines how much the water will be turned around the point waterPos
    7777  Vector              waterColor;             //!< color of the water
    78   float               move;                   //!< textures coords, speeds, positions for the shaded textures....
     78
     79  Vector              newWaterColor;          //!< used to fade the water color
     80  float               colorFadeTime;
     81
     82  float               move;
    7983  float               move2;
    8084  float               waterUV;                //!< size of the waves
Note: See TracChangeset for help on using the changeset viewer.