Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 11, 2005, 12:55:48 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: setClassID implemented in all files

File:
1 edited

Legend:

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

    r3982 r4597  
    1414*/
    1515
    16 /*! 
     16/*!
    1717    \file t_animation.h
    1818*/
     
    8080*/
    8181template<class T>
    82 tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 
     82tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float))
    8383{
    8484  // create a new List
     
    100100/**
    101101   \brief standard deconstructor
    102    
     102
    103103   deletes all the Keyframes
    104104*/
    105105template<class T>
    106 tAnimation<T>::~tAnimation () 
     106tAnimation<T>::~tAnimation ()
    107107{
    108108  // delete all the KeyFrames
     
    158158
    159159  KeyFrameF* tmpKeyFrame;
    160    
     160
    161161  // when adding the first frame
    162162  if (this->keyFrameCount == 0)
     
    170170      // when adding the second frame
    171171      if (this->currentKeyFrame == this->nextKeyFrame)
    172         this->nextKeyFrame = tmpKeyFrame;
     172        this->nextKeyFrame = tmpKeyFrame;
    173173      this->keyFrameList->add(tmpKeyFrame);
    174174    }
     
    191191      this->localTime += dt;
    192192      if (localTime >= this->currentKeyFrame->duration)
    193         {
    194           if (likely(this->keyFramesToPlay != 0))
    195             {
    196               if (unlikely(this->keyFramesToPlay > 0))
    197                 --this->keyFramesToPlay;
    198               // switching to the next Key-Frame
    199               this->localTime -= this->currentKeyFrame->duration;
    200              
    201               this->currentKeyFrame = this->nextKeyFrame;
    202               // checking, if we should still Play the animation
    203               if (this->currentKeyFrame == this->keyFrameList->lastElement())
    204                 this->handleInfinity();
    205               this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
    206              
    207               printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
    208               this->setAnimFunc(this->currentKeyFrame->animFunc);         
    209             }
    210           else
    211             this->pause();
    212         }
    213      
     193        {
     194          if (likely(this->keyFramesToPlay != 0))
     195            {
     196              if (unlikely(this->keyFramesToPlay > 0))
     197                --this->keyFramesToPlay;
     198              // switching to the next Key-Frame
     199              this->localTime -= this->currentKeyFrame->duration;
     200
     201              this->currentKeyFrame = this->nextKeyFrame;
     202              // checking, if we should still Play the animation
     203              if (this->currentKeyFrame == this->keyFrameList->lastElement())
     204                this->handleInfinity();
     205              this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
     206
     207              printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value);
     208              this->setAnimFunc(this->currentKeyFrame->animFunc);
     209            }
     210          else
     211            this->pause();
     212        }
     213
    214214      (this->object->*(funcToAnim))((this->*animFunc)(this->localTime));
    215215    }
     
    243243    case ANIM_NEG_EXP:
    244244      {
    245         this->animFunc = &tAnimation<T>::negExp;
    246         expFactor =  - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X);
    247         break;
     245        this->animFunc = &tAnimation<T>::negExp;
     246        expFactor =  - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X);
     247        break;
    248248      }
    249249    case ANIM_QUADRATIC:
     
    273273*/
    274274template<class T>
    275 float tAnimation<T>::linear(float timePassed) const 
     275float tAnimation<T>::linear(float timePassed) const
    276276{
    277277  return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value)
     
    287287{
    288288  if (timePassed * 2.0 < this->currentKeyFrame->duration)
    289     return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 
     289    return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value)
    290290      * sin( M_PI * timePassed / this->currentKeyFrame->duration)/2;
    291   else 
     291  else
    292292    return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)
    293293      * sin( M_PI * (1.0 - timePassed / this->currentKeyFrame->duration))/2;
     
    350350float tAnimation<T>::random(float timePassed) const
    351351{
    352   return this->currentKeyFrame->value + 
     352  return this->currentKeyFrame->value +
    353353    (this->nextKeyFrame->value - this->currentKeyFrame->value) *
    354354    (float)rand()/(float)RAND_MAX;
Note: See TracChangeset for help on using the changeset viewer.