Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2006, 6:21:24 PM (18 years ago)
Author:
stefalie
Message:

mountain_lake: fading works… sometimes :-)

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

    r8877 r8884  
    1919#include "util/loading/resource_manager.h"
    2020#include "state.h"
     21#include "t_animation.h"
    2122#include "math.h"
    2223
     
    3940  if (root != NULL)
    4041    this->loadParams(root);
     42  this->newShineSize = this->shineSize;
     43
    4144
    4245  /// initialization of the textures
     
    9295  this->move = 0;
    9396  this->move2 = this->move * this->kNormalMapScale;
    94 
    95 
    9697}
    9798
     
    370371  this->move += this->waterFlow * dt;
    371372  this->move2 = this->move * this->kNormalMapScale;
    372  
    373 
    374 //   if(this->tempcounter == 100) {
    375 //     this->resetWaterColor(1, 0, 0);
    376 //     resetShininess(1);
    377 //     resetLightPos(0, 50, 0);
    378 //     PRINTF(0)("test waterchangecolor ");
    379 //     }
    380 //   tempcounter++;
     373
     374  // fading
     375  if(this->shineSize != this->newShineSize)
     376  {
     377    if(bFadeShineSize)
     378    {
     379      this->shineSizeFader = new tAnimation<MappedWater>(this, &MappedWater::resetShineSize);
     380      this->shineSizeFader->setInfinity(ANIM_INF_CONSTANT);
     381
     382      this->shineSizeFader->addKeyFrame(this->shineSize, this->shineSizeFadeTime, ANIM_LINEAR);
     383      this->shineSizeFader->addKeyFrame(this->newShineSize, 0, ANIM_LINEAR);
     384
     385      bFadeShineSize = false;
     386      this->shineSizeFader->replay();
     387    }
     388  }
     389
     390  if(this->tempcounter == 100)
     391  {
     392    PRINTF(0)("\n\n\n\n\n\n///////////////////////test waterchangecolor/////////////////////\n\n\n\n\n\n");
     393    this->fadeShineSize(1, 10);
     394  }
     395  //PRINTF(0)("counter %i/n", tempcounter);
     396  tempcounter++;
    381397
    382398//   if(this->tempcounter == 100) {
  • branches/mountain_lake/src/world_entities/environments/mapped_water.h

    r8877 r8884  
    2828#include "shader.h"
    2929
     30// forward declaration
     31template <class T> class tAnimation;
    3032
    3133class MappedWater : public WorldEntity
     
    7577  // fade functions, hacky HACK
    7678  void fadeWaterColor(float r, float g, float b, float time) {this->newWaterColor = Vector(r, g, b); this->colorFadeTime = time; }
    77   void fadeShininess(float shine, float time);
     79  void fadeShineSize(float shine, float time) {this->newShineSize = shine; this->shineSizeFadeTime = time; }
    7880  void fadeLightPos(float x, float y, float z, float time);
    7981
     
    120122  Shader::Uniform*    refr_uni;               //!< uniform that is used for the strength of the refraction
    121123
     124  // fading
     125  tAnimation<MappedWater>*      shineSizeFader;
     126  float                         newShineSize;
     127  float                         shineSizeFadeTime;
     128  bool                          bFadeShineSize;
     129
    122130  // skirmish HACK
    123131  Vector              newWaterColor;          //!< used to fade the water color
Note: See TracChangeset for help on using the changeset viewer.