Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3848 in orxonox.OLD


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

orxonox/trunk: names of keyframes:
KeyFrame → KeyFrame3D
AnimKeyFrame → KeyFrameF (F for float)

also changed some stuff in the Animation3D-class.

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

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

    r3847 r3848  
    4848                            ANIM_INF_REWIND};//, ANIM_DELETE}
    4949
    50 typedef struct AnimKeyFrame
     50typedef struct KeyFrameF
    5151{
    5252  float duration;
     
    128128  //  ANIM_FUNCTION animFunc;
    129129  float (tAnimation<T>::*animFunc)(float) const;
    130   AnimKeyFrame* currentKeyFrame;
    131   AnimKeyFrame* nextKeyFrame;
    132   tList<AnimKeyFrame>* keyFrameList;
     130  KeyFrameF* currentKeyFrame;
     131  KeyFrameF* nextKeyFrame;
     132  tList<KeyFrameF>* keyFrameList;
    133133
    134134
     
    151151{
    152152  // create a new List
    153   this->keyFrameList = new tList<AnimKeyFrame>();
    154   AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame;
     153  this->keyFrameList = new tList<KeyFrameF>();
     154  KeyFrameF* tmpKeyFrame = new KeyFrameF;
    155155  tmpKeyFrame->value = 0.0;
    156156  tmpKeyFrame->duration = 1.0;
     
    174174{
    175175  // delete all the KeyFrames
    176   tIterator<AnimKeyFrame>* itKF = keyFrameList->getIterator();
    177   AnimKeyFrame*  enumKF = itKF->nextElement();
     176  tIterator<KeyFrameF>* itKF = keyFrameList->getIterator();
     177  KeyFrameF*  enumKF = itKF->nextElement();
    178178  while (enumKF)
    179179    {
     
    209209 
    210210
    211   AnimKeyFrame* tmpKeyFrame;
     211  KeyFrameF* tmpKeyFrame;
    212212   
    213213  if (bHasKeys)
    214214    {
    215       tmpKeyFrame = new AnimKeyFrame;
     215      tmpKeyFrame = new KeyFrameF;
    216216      if (this->currentKeyFrame == this->nextKeyFrame)
    217217        this->nextKeyFrame = tmpKeyFrame;
  • orxonox/trunk/src/simple_animation.cc

    r3847 r3848  
    2626
    2727
     28Animation3D::Animation3D(void)
     29{
     30
     31}
     32
     33Animation3D::~Animation3D(void)
     34{
     35
     36}
     37
     38
     39void Animation3D::rewind(void)
     40{
     41
     42}
     43
     44
     45void Animation3D::tick(float timePassed)
     46{
     47
     48}
     49
     50
     51
     52
     53
     54
    2855
    2956SimpleAnimation* SimpleAnimation::singletonRef = 0;
     
    4572{
    4673   this->setClassName ("SimpleAnimation");
    47    this->frames = new tList<KeyFrame>();
     74   this->frames = new tList<KeyFrame3D>();
    4875   this->animators = new tList<Animation3D>();
    4976   this->localTime = 0;
     
    6491SimpleAnimation::~SimpleAnimation ()
    6592{
    66   tIterator<KeyFrame>* iterator = this->frames->getIterator();
    67   KeyFrame* frame = iterator->nextElement();
     93  tIterator<KeyFrame3D>* iterator = this->frames->getIterator();
     94  KeyFrame3D* frame = iterator->nextElement();
    6895  while( frame != NULL)
    6996    {
     
    106133  Vector* lastPosition;
    107134  Vector* tmpVect;
    108   tList<KeyFrame>* frames;
     135  tList<KeyFrame3D>* frames;
    109136  animationMode animMode;
    110137  movementMode movMode;
     
    126153      anim->lastPosition = new Vector();
    127154      anim->tmpVect = new Vector();
    128       anim->frames = new tList<KeyFrame>();
     155      anim->frames = new tList<KeyFrame3D>();
    129156      anim->animMode = LOOP;
    130157      anim->bRunning = false;
     
    150177      return;
    151178    }
    152   KeyFrame* frame = new KeyFrame;
     179  KeyFrame3D* frame = new KeyFrame3D;
    153180  frame->position = point;
    154181  frame->direction = direction;
     
    174201      return;
    175202    }
    176   KeyFrame* frame = new KeyFrame;
     203  KeyFrame3D* frame = new KeyFrame3D;
    177204  frame->position = point;
    178205  frame->direction = direction;
     
    187214   \param the keyframe to add
    188215*/
    189 void SimpleAnimation::addKeyFrame(KeyFrame* frame)
     216void SimpleAnimation::addKeyFrame(KeyFrame3D* frame)
    190217{
    191218  if( !this->bDescriptive || this->workingAnimator == NULL)
     
    215242{
    216243  /*
    217   tIterator<KeyFrame>* iterator = this->frames->getIterator();
    218   KeyFrame* frame = iterator->nextElement();
     244  tIterator<KeyFrame3D>* iterator = this->frames->getIterator();
     245  KeyFrame3D* frame = iterator->nextElement();
    219246  while( frame != NULL)
    220247    {
     
    225252  delete this->frames;
    226253
    227   this->frames = new tList<KeyFrame>();
     254  this->frames = new tList<KeyFrame3D>();
    228255  this->localTime = 0;
    229256  this->bRunning = false;
  • orxonox/trunk/src/simple_animation.h

    r3847 r3848  
    1313#include "base_object.h"
    1414#include "list.h"
    15 #include "animation_player.h"
     15#include "animation.h"
    1616
    1717
     
    3030   This represents one point with direction of the animation
    3131*/
    32 typedef struct KeyFrame {
     32typedef struct KeyFrame3D {
    3333  Vector* position;
    3434  Quaternion* direction;
     
    4242   This represents an animation for a object
    4343*/
    44 class Animation3D
     44class Animation3D : public Animation
    4545{
    4646 public:
     47  Animation3D(void);
     48  virtual ~Animation3D(void);
     49   
     50  virtual void rewind(void);
     51
     52  void addKeyFrame(Vector* point, Quaternion* direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR);
     53  void addKeyFrame(KeyFrame3D* frame);
     54
     55  virtual void tick(float timePassed);
     56
     57  // animation functions
     58  void setAnimFunc(ANIM_FUNCTION animFunc);
     59
     60  float constant(float timePassed) const;
     61  float linear(float timePassed) const;
     62  float sine(float timePassed) const;
     63  float cosine(float timePassed) const;
     64  float exp(float timePassed) const;
     65  float negExp(float timePassed) const;
     66  float quadratic(float timePassed) const;
     67  float random(float timePassed) const;
     68  //  ANIM_FUNCTION animFunc;
     69  KeyFrame3D* currentKeyFrame;
     70  KeyFrame3D* nextKeyFrame;
     71  tList<KeyFrame3D>* keyFrameList;
     72
     73  // private
    4774  WorldEntity* object;
    4875  Vector* lastPosition;
     
    5178  float localTime;
    5279
    53   tList<KeyFrame>* frames;
    54   KeyFrame* currentFrame;
    55   KeyFrame* lastFrame;
     80  tList<KeyFrame3D>* frames;
     81  KeyFrame3D* currentFrame;
     82  KeyFrame3D* lastFrame;
    5683
    5784  bool bRunning;
     
    75102  void addKeyFrame(Vector* point, Quaternion* direction, float time);
    76103  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
    77   void addKeyFrame(KeyFrame* frame);
     104  void addKeyFrame(KeyFrame3D* frame);
    78105  void setAnimationMode(animationMode mode);
    79106  void reset();
     
    94121  bool bDescriptive;               //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands
    95122  bool bRunning;                   //<! is set, when the animation is running
    96   tList<KeyFrame>* frames;         //<! where keyframes are stored in
     123  tList<KeyFrame3D>* frames;         //<! where keyframes are stored in
    97124  tList<Animation3D>* animators;      //<! a list of animation's
    98   KeyFrame* currentFrame;          //<! the frame that is been played now
    99   KeyFrame* lastFrame;
     125  KeyFrame3D* currentFrame;          //<! the frame that is been played now
     126  KeyFrame3D* lastFrame;
    100127  Vector* lastPosition;
    101128  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
  • orxonox/trunk/src/story_entities/world.cc

    r3846 r3848  
    484484            this->spawn(c);
    485485           
    486            
    487             KeyFrame* f1 = new KeyFrame;
    488             f1->position = new Vector(-1.1, 0.0, 2.6);
    489             f1->direction = new Quaternion();
    490             f1->time = 1.0;
    491             f1->mode = NEG_EXP;
    492 
    493 
    494             KeyFrame* f2 = new KeyFrame;
    495             f2->position = new Vector(-2.1, 0.0, 2.6);
    496             f2->direction = new Quaternion();
    497             f2->time = 0.1;
    498             f2->mode = NEG_EXP;
    499 
    500             KeyFrame* f3 = new KeyFrame;
    501             f3->position = new Vector(10.0, 2.0, -1.0);
    502             f3->direction = new Quaternion();
    503             f3->time = 0.2;
    504             f3->mode = NEG_EXP;
    505 
    506             KeyFrame* f4 = new KeyFrame;
    507             f4->position = new Vector(10.0, 5.0, -1.0);
    508             f4->direction = new Quaternion();
    509             f4->time = 1.0;
    510             f4->mode = NEG_EXP;
    511 
    512 
    513 
    514             this->simpleAnimation->animatorBegin();
    515             this->simpleAnimation->selectObject(b);
    516             this->simpleAnimation->setAnimationMode(SINGLE);
    517             this->simpleAnimation->addKeyFrame(f1);
    518             this->simpleAnimation->addKeyFrame(f2);
    519             this->simpleAnimation->start();
    520             this->simpleAnimation->selectObject(c);
    521             this->simpleAnimation->addKeyFrame(f3);
    522             this->simpleAnimation->addKeyFrame(f4);
    523             this->simpleAnimation->start();
    524             this->simpleAnimation->animatorEnd();
    525 
     486            /*     
     487                  KeyFrame* f1 = new KeyFrame;
     488                  f1->position = new Vector(-1.1, 0.0, 2.6);
     489                  f1->direction = new Quaternion();
     490                  f1->time = 1.0;
     491                  f1->mode = NEG_EXP;
     492                 
     493                 
     494                  KeyFrame* f2 = new KeyFrame;
     495                  f2->position = new Vector(-2.1, 0.0, 2.6);
     496                  f2->direction = new Quaternion();
     497                  f2->time = 0.1;
     498                  f2->mode = NEG_EXP;
     499                 
     500                  KeyFrame* f3 = new KeyFrame;
     501                  f3->position = new Vector(10.0, 2.0, -1.0);
     502                  f3->direction = new Quaternion();
     503                  f3->time = 0.2;
     504                  f3->mode = NEG_EXP;
     505                 
     506                  KeyFrame* f4 = new KeyFrame;
     507                  f4->position = new Vector(10.0, 5.0, -1.0);
     508                  f4->direction = new Quaternion();
     509                  f4->time = 1.0;
     510                  f4->mode = NEG_EXP;
     511                 
     512                 
     513                 
     514                  this->simpleAnimation->animatorBegin();
     515                  this->simpleAnimation->selectObject(b);
     516                  this->simpleAnimation->setAnimationMode(SINGLE);
     517                  this->simpleAnimation->addKeyFrame(f1);
     518                  this->simpleAnimation->addKeyFrame(f2);
     519                  this->simpleAnimation->start();
     520                  this->simpleAnimation->selectObject(c);
     521                  this->simpleAnimation->addKeyFrame(f3);
     522                  this->simpleAnimation->addKeyFrame(f4);
     523                  this->simpleAnimation->start();
     524                  this->simpleAnimation->animatorEnd();
     525            */
    526526
    527527            /*
Note: See TracChangeset for help on using the changeset viewer.