Changeset 10618 in orxonox.OLD for trunk/src/util/animation/animation3d.cc
- Timestamp:
- Apr 4, 2007, 12:13:53 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 16 16 OrxonoxPlayability.kdevses 17 17 OrxonoxPlayability.kdevelop.pcs 18 orxonox.backtrace 19 orxonox.kdevses 20 orxonox.kdevelop.pcs
-
- Property svn:ignore
-
trunk/src/util/animation/animation3d.cc
r9406 r10618 35 35 36 36 // 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(); 45 42 46 43 this->animFuncMov = NULL;//&Animation3D::mLinear; 47 44 this->animFuncRot = NULL;//&Animation3D::rLinear; 48 49 45 } 50 46 … … 56 52 Animation3D::~Animation3D() 57 53 { 58 // delete all the KeyFrames59 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;68 54 } 69 55 … … 73 59 void Animation3D::rewind() 74 60 { 75 this->currentKeyFrame = keyFrameList ->firstElement();76 this->nextKeyFrame = keyFrameList ->nextElement(keyFrameList->firstElement());61 this->currentKeyFrame = keyFrameList.begin(); 62 this->nextKeyFrame = keyFrameList.begin()++; 77 63 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); 80 66 } 81 67 … … 100 86 // animFuncRot = animFuncMov; 101 87 102 KeyFrame3D * tmpKeyFrame;88 KeyFrame3D& tmpKeyFrame = keyFrameList.front(); 103 89 104 90 // when adding the first frame 105 91 if (this->keyFrameCount == 0) 106 92 { 107 tmpKeyFrame = this->keyFrameList->firstElement();108 93 //this->setAnimFuncMov(animFuncMov); 109 94 //this->setAnimFuncRot(animFuncRot); … … 111 96 else 112 97 { 113 tmpKeyFrame = new KeyFrame3D;114 98 // when adding the second frame 99 this->keyFrameList.push_back(KeyFrame3D()); 115 100 if (this->currentKeyFrame == this->nextKeyFrame) 116 this->nextKeyFrame = tmpKeyFrame; 117 this->keyFrameList->add(tmpKeyFrame); 101 this->nextKeyFrame = --keyFrameList.end(); 118 102 } 119 103 120 tmpKeyFrame ->position = position;104 tmpKeyFrame.position = position; 121 105 //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; 126 110 this->keyFrameCount++; 127 111 } … … 146 130 this->currentKeyFrame = this->nextKeyFrame; 147 131 // checking, if we should still Play the animation 148 if (this->currentKeyFrame == this->keyFrameList->lastElement())132 if (this->currentKeyFrame == --this->keyFrameList.end()) 149 133 this->handleInfinity(); 150 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 134 this->nextKeyFrame = this->currentKeyFrame; 135 this->nextKeyFrame++; 151 136 this->setAnimFuncMov(this->currentKeyFrame->animFuncMov); 152 137 this->setAnimFuncRot(this->currentKeyFrame->animFuncRot);
Note: See TracChangeset
for help on using the changeset viewer.