Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

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

@paede: i hope you like it.

Location:
orxonox/trunk/src
Files:
10 edited

Legend:

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

    r3833 r3847  
    2020
    2121
    22 Anim::Anim(void)
     22Animation::Animation(void)
    2323
    2424  // initialize a beginning KeyFrame, that will be deleted afterwards
     
    3434}
    3535
    36 Anim::~Anim(void)
     36Animation::~Animation(void)
    3737{
    3838  this->doNotHandle();
    3939}
    4040
    41 void Anim::doNotHandle(void)
     41void Animation::doNotHandle(void)
    4242{
    4343  if (this->bHandled)
     
    4646
    4747
    48 void Anim::setInfinity(ANIM_INFINITY postInfinity)
     48void Animation::setInfinity(ANIM_INFINITY postInfinity)
    4949{
    5050  this->postInfinity = postInfinity;
     
    5252
    5353
    54 void Anim::play()
     54void Animation::play()
    5555{
    5656  this->bRunning = true;
     
    5858
    5959
    60 void Anim::stop()
     60void Animation::stop()
    6161{
    6262  this->rewind();
     
    6565  this->bRunning = false;
    6666}
    67 void Anim::pause()
     67void Animation::pause()
    6868{
    6969  this->bRunning = false;
    7070}
    71 void Anim::replay()
     71void Animation::replay()
    7272{
    7373  this->rewind();
  • 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
  • orxonox/trunk/src/animation_player.cc

    r3833 r3847  
    2828   this->setClassName ("AnimationPlayer");
    2929
    30    this->animationList = new tList<Anim>();
     30   this->animationList = new tList<Animation>();
    3131   this->play();
    3232}
     
    7272   unadding it with animation->notHandled();
    7373*/
    74 void AnimationPlayer::addAnimation(Anim* animation)
     74void AnimationPlayer::addAnimation(Animation* animation)
    7575{
    7676  this->animationList->add(animation);
     
    8181   \param animation the Anmination to remove from the List
    8282*/
    83 void AnimationPlayer::removeAnimation(Anim* animation)
     83void AnimationPlayer::removeAnimation(Animation* animation)
    8484{
    8585  this->animationList->remove(animation);
     
    9292{
    9393  // deleting the Animation List AND all the elements of the List
    94   tIterator<Anim>* animIt = this->animationList->getIterator();
    95   Anim* anim = animIt->nextElement();
     94  tIterator<Animation>* animIt = this->animationList->getIterator();
     95  Animation* anim = animIt->nextElement();
    9696  while( anim != NULL)
    9797    {
     
    103103
    104104  delete this->animationList;
    105   this->animationList = new tList<Anim>();
     105  this->animationList = new tList<Animation>();
    106106}
    107107
     
    115115    {
    116116      // iterate through all the animations and tick them.
    117       tIterator<Anim>* animIt = this->animationList->getIterator();
    118       Anim* anim = animIt->nextElement();
     117      tIterator<Animation>* animIt = this->animationList->getIterator();
     118      Animation* anim = animIt->nextElement();
    119119      while( anim != NULL)
    120120        {
     
    142142
    143143
    144 Anim* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
     144Animation* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const
    145145{
    146   tIterator<Anim>* animIt = this->animationList->getIterator();
    147   Anim* anim = animIt->nextElement();
     146  tIterator<Animation>* animIt = this->animationList->getIterator();
     147  Animation* anim = animIt->nextElement();
    148148  while( anim != NULL)
    149149    {
     
    173173  PRINT(0)("-Animation Information---------------+\n");
    174174  // Per ANIMATION DEBUG
    175   tIterator<Anim>* animIt = this->animationList->getIterator();
    176   Anim* anim = animIt->nextElement();
     175  tIterator<Animation>* animIt = this->animationList->getIterator();
     176  Animation* anim = animIt->nextElement();
    177177  while( anim != NULL)
    178178    {
  • orxonox/trunk/src/animation_player.h

    r3833 r3847  
    3333
    3434  // animation handling
    35   void addAnimation(Anim* animation);
    36   void removeAnimation(Anim* animation);
     35  void addAnimation(Animation* animation);
     36  void removeAnimation(Animation* animation);
    3737  void flush(void);
    3838
     
    4242  void pause(void);
    4343
    44   Anim* getObjectFromBaseObject(const BaseObject* baseObject) const;
     44  Animation* getObjectFromBaseObject(const BaseObject* baseObject) const;
    4545
    4646  void debug(void);
     
    5252
    5353  /* class specific */
    54   tList<Anim>* animationList;              //!< A List of Animations to be handled.
     54  tList<Animation>* animationList;         //!< A List of Animations to be handled.
    5555  bool bRunning;                           //!< If the AnimationPlayer is running.
    5656};
  • orxonox/trunk/src/simple_animation.cc

    r3832 r3847  
    4646   this->setClassName ("SimpleAnimation");
    4747   this->frames = new tList<KeyFrame>();
    48    this->animators = new tList<Animation>();
     48   this->animators = new tList<Animation3D>();
    4949   this->localTime = 0;
    5050   this->bRunning = false;
     
    119119void SimpleAnimation::selectObject(WorldEntity* entity)
    120120{
    121   Animation* anim = getAnimationFromWorldEntity(entity);
     121  Animation3D* anim = getAnimationFromWorldEntity(entity);
    122122  if( anim == NULL)
    123123    {
    124       anim = new Animation;
     124      anim = new Animation3D;
    125125      anim->object = entity;
    126126      anim->lastPosition = new Vector();
     
    310310void SimpleAnimation::tick(float time)
    311311{
    312   tIterator<Animation>* iterator = this->animators->getIterator();
    313   Animation* anim = iterator->nextElement();
     312  tIterator<Animation3D>* iterator = this->animators->getIterator();
     313  Animation3D* anim = iterator->nextElement();
    314314  while( anim != NULL)
    315315    {
     
    383383
    384384
    385 Animation* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)
    386 {
    387   tIterator<Animation>* iterator = this->animators->getIterator();
    388   Animation* anim = iterator->nextElement();
     385Animation3D* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)
     386{
     387  tIterator<Animation3D>* iterator = this->animators->getIterator();
     388  Animation3D* anim = iterator->nextElement();
    389389  while( anim != NULL)
    390390    {
  • orxonox/trunk/src/simple_animation.h

    r3752 r3847  
    1313#include "base_object.h"
    1414#include "list.h"
     15#include "animation_player.h"
    1516
    1617
     
    4142   This represents an animation for a object
    4243*/
    43 typedef struct Animation {
    44 
     44class Animation3D
     45{
     46 public:
    4547  WorldEntity* object;
    4648  Vector* lastPosition;
     
    6466*/
    6567class SimpleAnimation : public BaseObject {
    66  
    6768 public:
    6869  static SimpleAnimation* getInstance();
     
    9495  bool bRunning;                   //<! is set, when the animation is running
    9596  tList<KeyFrame>* frames;         //<! where keyframes are stored in
    96   tList<Animation>* animators;      //<! a list of animation's
     97  tList<Animation3D>* animators;      //<! a list of animation's
    9798  KeyFrame* currentFrame;          //<! the frame that is been played now
    9899  KeyFrame* lastFrame;
     
    104105  Vector* tmpVect;                 //<! this is the temporary vector save place -
    105106  WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
    106   Animation* workingAnimator;       //<! the animator with which you are currently working
     107  Animation3D* workingAnimator;       //<! the animator with which you are currently working
    107108  float deltaT;                    //<! this is a time constant for the movement
    108109
    109   Animation* getAnimationFromWorldEntity(WorldEntity* entity);
     110  Animation3D* getAnimationFromWorldEntity(WorldEntity* entity);
    110111
    111112};
  • orxonox/trunk/src/story_entities/world.h

    r3812 r3847  
    9999  GLMenuImageScreen* glmis;           //!< The Level-Loader Display
    100100
    101   Text* testText;                     //!< A text to Test the TextEngine;
    102 
    103101  char* worldName;                    //!< The name of this World
    104102  int debugWorldNr;                   //!< The Debug Nr. needed, if something goes wrong
  • orxonox/trunk/src/track_manager.cc

    r3846 r3847  
    393393  this->trackText->setAlignment(TEXT_ALIGN_SCREEN_CENTER);
    394394  // initializing the Animation for the Text.
    395   this->textAnimation = new tAnim<Text>(this->trackText, &Text::setBlending);
    396   this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_LINEAR);
     395  this->textAnimation = new tAnimation<Text>(this->trackText, &Text::setBlending);
     396  this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_NEG_EXP);
    397397  this->textAnimation->addKeyFrame(0.0, .001);
    398398  this->textAnimation->setInfinity(ANIM_INF_CONSTANT);
  • orxonox/trunk/src/track_manager.h

    r3845 r3847  
    1818class PNode;
    1919class Text;
    20 template<class T> class tAnim;
     20template<class T> class tAnimation;
    2121template<class T> class tList;
    2222
     
    144144  PNode* trackNode;                   //!< The main TrackNode of this Track.
    145145  Text* trackText;                    //!< The text to display when switching between Worlds.
    146   tAnim<Text>* textAnimation;         //!< An Animation for the Text.
     146  tAnimation<Text>* textAnimation;    //!< An Animation for the Text.
    147147 
    148148  void initChildren(unsigned int childCount, TrackElement* trackElem = NULL);
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3757 r3847  
    5252    this->projOffset = new Vector(1.0, 0.0, 0.5);
    5353
     54
    5455  this->animator = SimpleAnimation::getInstance();
    55   this->dummy1 = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */
     56  this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon
     57  /*
    5658  parent->addChild(this->dummy1, PNODE_ALL);
    5759
     
    7375    }
    7476  this->animator->animatorEnd();
    75  
     77  */
    7678}
    7779
     
    131133  this->localTime = 0;
    132134 
    133   this->animator->animatorBegin();
    134   this->animator->selectObject(this->dummy1);
    135   this->animator->start();
    136   this->animator->animatorEnd();
     135  /*
     136    this->animator->animatorBegin();
     137    this->animator->selectObject(this->dummy1);
     138    this->animator->start();
     139    this->animator->animatorEnd();
     140  */
    137141}
    138142
Note: See TracChangeset for help on using the changeset viewer.