Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10618 in orxonox.OLD for trunk/src/util/animation/animation3d.cc


Ignore:
Timestamp:
Apr 4, 2007, 12:13:53 PM (17 years ago)
Author:
bknecht
Message:

merged cleanup into trunk (only improvements)

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        1616OrxonoxPlayability.kdevses
        1717OrxonoxPlayability.kdevelop.pcs
         18orxonox.backtrace
         19orxonox.kdevses
         20orxonox.kdevelop.pcs
  • trunk/src/util/animation/animation3d.cc

    r9406 r10618  
    3535
    3636  // create a new List
    37   this->keyFrameList = new tList<KeyFrame3D>();
    38   KeyFrame3D* tmpKeyFrame = new KeyFrame3D;
    39   tmpKeyFrame->position = Vector();
    40   tmpKeyFrame->direction = Quaternion();
    41   keyFrameList->add(tmpKeyFrame);
    42 
    43   this->currentKeyFrame = tmpKeyFrame;
    44   this->nextKeyFrame = tmpKeyFrame;
     37  KeyFrame3D tmpKeyFrame;
     38  keyFrameList.push_back(tmpKeyFrame);
     39
     40  this->currentKeyFrame = keyFrameList.begin();
     41  this->nextKeyFrame = keyFrameList.begin();
    4542
    4643  this->animFuncMov = NULL;//&Animation3D::mLinear;
    4744  this->animFuncRot = NULL;//&Animation3D::rLinear;
    48 
    4945}
    5046
     
    5652Animation3D::~Animation3D()
    5753{
    58   // delete all the KeyFrames
    59   tIterator<KeyFrame3D>* itKF = keyFrameList->getIterator();
    60   KeyFrame3D*  enumKF = itKF->firstElement();
    61   while (enumKF)
    62     {
    63       delete enumKF;
    64       enumKF = itKF->nextElement();
    65     }
    66   delete itKF;
    67   delete this->keyFrameList;
    6854}
    6955
     
    7359void Animation3D::rewind()
    7460{
    75   this->currentKeyFrame = keyFrameList->firstElement();
    76   this->nextKeyFrame = keyFrameList->nextElement(keyFrameList->firstElement());
     61  this->currentKeyFrame = keyFrameList.begin();
     62  this->nextKeyFrame = keyFrameList.begin()++;
    7763  this->localTime = 0.0;
    78   this->setAnimFuncMov(this->currentKeyFrame->animFuncMov);
    79   this->setAnimFuncRot(this->currentKeyFrame->animFuncRot);
     64  this->setAnimFuncMov((*this->currentKeyFrame).animFuncMov);
     65  this->setAnimFuncRot((*this->currentKeyFrame).animFuncRot);
    8066}
    8167
     
    10086//    animFuncRot = animFuncMov;
    10187
    102   KeyFrame3D* tmpKeyFrame;
     88  KeyFrame3D& tmpKeyFrame = keyFrameList.front();
    10389
    10490  // when adding the first frame
    10591  if (this->keyFrameCount == 0)
    10692    {
    107       tmpKeyFrame = this->keyFrameList->firstElement();
    10893      //this->setAnimFuncMov(animFuncMov);
    10994      //this->setAnimFuncRot(animFuncRot);
     
    11196  else
    11297    {
    113       tmpKeyFrame = new KeyFrame3D;
    11498      // when adding the second frame
     99      this->keyFrameList.push_back(KeyFrame3D());
    115100      if (this->currentKeyFrame == this->nextKeyFrame)
    116         this->nextKeyFrame = tmpKeyFrame;
    117       this->keyFrameList->add(tmpKeyFrame);
     101        this->nextKeyFrame = --keyFrameList.end();
    118102    }
    119103
    120   tmpKeyFrame->position = position;
     104  tmpKeyFrame.position = position;
    121105  //tmpKeyFrame->lastPosition = position;
    122   tmpKeyFrame->direction = direction;
    123   tmpKeyFrame->duration = duration;
    124   tmpKeyFrame->animFuncMov = animFuncMov;
    125   tmpKeyFrame->animFuncRot = animFuncRot;
     106  tmpKeyFrame.direction = direction;
     107  tmpKeyFrame.duration = duration;
     108  tmpKeyFrame.animFuncMov = animFuncMov;
     109  tmpKeyFrame.animFuncRot = animFuncRot;
    126110  this->keyFrameCount++;
    127111}
     
    146130              this->currentKeyFrame = this->nextKeyFrame;
    147131              // checking, if we should still Play the animation
    148               if (this->currentKeyFrame == this->keyFrameList->lastElement())
     132              if (this->currentKeyFrame == --this->keyFrameList.end())
    149133                this->handleInfinity();
    150               this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame);
     134              this->nextKeyFrame = this->currentKeyFrame;
     135              this->nextKeyFrame++;
    151136              this->setAnimFuncMov(this->currentKeyFrame->animFuncMov);
    152137              this->setAnimFuncRot(this->currentKeyFrame->animFuncRot);
Note: See TracChangeset for help on using the changeset viewer.