Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3847 in orxonox.OLD for orxonox/trunk/src/animation.h


Ignore:
Timestamp:
Apr 17, 2005, 2:01:28 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: naming of animation changed
Anim → Animation
tAnim → tAnimation
Animation → Animation3D

@paede: i hope you like it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/animation.h

    r3846 r3847  
    5555};
    5656
    57 class Anim
     57class Animation
    5858{
    5959 public:
    60   virtual ~Anim(void);
     60  virtual ~Animation(void);
    6161  void doNotHandle(void);
    6262
     
    8787
    8888 protected:
    89   Anim(void);
     89  Animation(void);
    9090
    9191  // variables
     
    102102
    103103//! A Class to handle some animation for single floated values.
    104 template<class T> class tAnim : public Anim
     104template<class T> class tAnimation : public Animation
    105105{
    106106 public:
    107   tAnim(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
    108   virtual ~tAnim();
     107  tAnimation(T* object = NULL, void (T::*funcToAnim)(float) = NULL);
     108  virtual ~tAnimation();
    109109
    110110  virtual void rewind();
     
    127127  float random(float timePassed) const;
    128128  //  ANIM_FUNCTION animFunc;
    129   float (tAnim<T>::*animFunc)(float) const;
     129  float (tAnimation<T>::*animFunc)(float) const;
    130130  AnimKeyFrame* currentKeyFrame;
    131131  AnimKeyFrame* nextKeyFrame;
     
    148148*/
    149149template<class T>
    150 tAnim<T>::tAnim (T* object, void (T::*funcToAnim)(float))
     150tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float))
    151151{
    152152  // create a new List
     
    160160  this->nextKeyFrame = tmpKeyFrame;
    161161
    162   this->animFunc = &tAnim<T>::linear;
     162  this->animFunc = &tAnimation<T>::linear;
    163163
    164164  this->setFuncToAnim(object, funcToAnim);
     
    171171*/
    172172template<class T>
    173 tAnim<T>::~tAnim ()
     173tAnimation<T>::~tAnimation ()
    174174{
    175175  // delete all the KeyFrames
     
    187187
    188188template<class T>
    189 void tAnim<T>::rewind(void)
     189void tAnimation<T>::rewind(void)
    190190{
    191191  this->currentKeyFrame = keyFrameList->firstElement();
     
    195195
    196196template<class T>
    197 void tAnim<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
     197void tAnimation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))
    198198{
    199199  this->baseObject = this->object = object;
     
    202202
    203203template<class T>
    204 void tAnim<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
     204void tAnimation<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)
    205205{
    206206  // some small check
     
    232232
    233233template<class T>
    234 void tAnim<T>::tick(float time)
     234void tAnimation<T>::tick(float time)
    235235{
    236236  if (this->bRunning)
     
    265265
    266266template<class T>
    267 void tAnim<T>::setAnimFunc(ANIM_FUNCTION animFunc)
     267void tAnimation<T>::setAnimFunc(ANIM_FUNCTION animFunc)
    268268{
    269269  switch (animFunc)
     
    271271    default:
    272272    case ANIM_CONSTANT:
    273       this->animFunc = &tAnim<T>::constant;
     273      this->animFunc = &tAnimation<T>::constant;
    274274      break;
    275275    case ANIM_LINEAR:
    276       this->animFunc = &tAnim<T>::linear;
     276      this->animFunc = &tAnimation<T>::linear;
    277277      break;
    278278    case ANIM_SINE:
    279       this->animFunc = &tAnim<T>::sine;
     279      this->animFunc = &tAnimation<T>::sine;
    280280      break;
    281281    case ANIM_COSINE:
    282       this->animFunc = &tAnim<T>::cosine;
     282      this->animFunc = &tAnimation<T>::cosine;
    283283      break;
    284284    case ANIM_EXP:
    285       this->animFunc = &tAnim<T>::exp;
     285      this->animFunc = &tAnimation<T>::exp;
    286286      break;
    287287    case ANIM_NEG_EXP:
    288288      {
    289         this->animFunc = &tAnim<T>::negExp;
     289        this->animFunc = &tAnimation<T>::negExp;
    290290        float d = fabs(this->currentKeyFrame->value - this->nextKeyFrame->value);
    291291        expFactor =  - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X);
     
    293293      }
    294294    case ANIM_QUADRATIC:
    295       this->animFunc = &tAnim<T>::quadratic;
     295      this->animFunc = &tAnimation<T>::quadratic;
    296296      break;
    297297    case ANIM_RANDOM:
    298       this->animFunc = &tAnim<T>::random;
     298      this->animFunc = &tAnimation<T>::random;
    299299      break;
    300300    }
     
    304304// animation functions
    305305template<class T>
    306 float tAnim<T>::random(float timePassed) const
     306float tAnimation<T>::random(float timePassed) const
    307307{
    308308  return (float)rand()/(float)RAND_MAX;
     
    310310
    311311template<class T>
    312 float tAnim<T>::constant(float timePassed) const
     312float tAnimation<T>::constant(float timePassed) const
    313313{
    314314  return this->currentKeyFrame->value;
     
    316316
    317317template<class T>
    318 float tAnim<T>::linear(float timePassed) const
     318float tAnimation<T>::linear(float timePassed) const
    319319{
    320320  return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value)
     
    325325
    326326template<class T>
    327 float tAnim<T>::sine(float timePassed) const
     327float tAnimation<T>::sine(float timePassed) const
    328328{
    329329  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
     
    337337
    338338template<class T>
    339 float tAnim<T>::cosine(float timePassed) const
     339float tAnimation<T>::cosine(float timePassed) const
    340340{
    341341  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
     
    350350
    351351template<class T>
    352 float tAnim<T>::exp(float timePassed) const
    353 {
    354 }
    355 
    356 template<class T>
    357 float tAnim<T>::negExp(float timePassed) const
     352float tAnimation<T>::exp(float timePassed) const
     353{
     354}
     355
     356template<class T>
     357float tAnimation<T>::negExp(float timePassed) const
    358358{
    359359  float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
     
    363363
    364364template<class T>
    365 float tAnim<T>::quadratic(float timePassed) const
     365float tAnimation<T>::quadratic(float timePassed) const
    366366{
    367367
Note: See TracChangeset for help on using the changeset viewer.