Changeset 3848 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 17, 2005, 2:16:45 AM (21 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 4 edited
-
animation.h (modified) (5 diffs)
-
simple_animation.cc (modified) (10 diffs)
-
simple_animation.h (modified) (6 diffs)
-
story_entities/world.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation.h
r3847 r3848 48 48 ANIM_INF_REWIND};//, ANIM_DELETE} 49 49 50 typedef struct AnimKeyFrame50 typedef struct KeyFrameF 51 51 { 52 52 float duration; … … 128 128 // ANIM_FUNCTION animFunc; 129 129 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; 133 133 134 134 … … 151 151 { 152 152 // 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; 155 155 tmpKeyFrame->value = 0.0; 156 156 tmpKeyFrame->duration = 1.0; … … 174 174 { 175 175 // 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(); 178 178 while (enumKF) 179 179 { … … 209 209 210 210 211 AnimKeyFrame* tmpKeyFrame;211 KeyFrameF* tmpKeyFrame; 212 212 213 213 if (bHasKeys) 214 214 { 215 tmpKeyFrame = new AnimKeyFrame;215 tmpKeyFrame = new KeyFrameF; 216 216 if (this->currentKeyFrame == this->nextKeyFrame) 217 217 this->nextKeyFrame = tmpKeyFrame; -
orxonox/trunk/src/simple_animation.cc
r3847 r3848 26 26 27 27 28 Animation3D::Animation3D(void) 29 { 30 31 } 32 33 Animation3D::~Animation3D(void) 34 { 35 36 } 37 38 39 void Animation3D::rewind(void) 40 { 41 42 } 43 44 45 void Animation3D::tick(float timePassed) 46 { 47 48 } 49 50 51 52 53 54 28 55 29 56 SimpleAnimation* SimpleAnimation::singletonRef = 0; … … 45 72 { 46 73 this->setClassName ("SimpleAnimation"); 47 this->frames = new tList<KeyFrame >();74 this->frames = new tList<KeyFrame3D>(); 48 75 this->animators = new tList<Animation3D>(); 49 76 this->localTime = 0; … … 64 91 SimpleAnimation::~SimpleAnimation () 65 92 { 66 tIterator<KeyFrame >* iterator = this->frames->getIterator();67 KeyFrame * frame = iterator->nextElement();93 tIterator<KeyFrame3D>* iterator = this->frames->getIterator(); 94 KeyFrame3D* frame = iterator->nextElement(); 68 95 while( frame != NULL) 69 96 { … … 106 133 Vector* lastPosition; 107 134 Vector* tmpVect; 108 tList<KeyFrame >* frames;135 tList<KeyFrame3D>* frames; 109 136 animationMode animMode; 110 137 movementMode movMode; … … 126 153 anim->lastPosition = new Vector(); 127 154 anim->tmpVect = new Vector(); 128 anim->frames = new tList<KeyFrame >();155 anim->frames = new tList<KeyFrame3D>(); 129 156 anim->animMode = LOOP; 130 157 anim->bRunning = false; … … 150 177 return; 151 178 } 152 KeyFrame * frame = new KeyFrame;179 KeyFrame3D* frame = new KeyFrame3D; 153 180 frame->position = point; 154 181 frame->direction = direction; … … 174 201 return; 175 202 } 176 KeyFrame * frame = new KeyFrame;203 KeyFrame3D* frame = new KeyFrame3D; 177 204 frame->position = point; 178 205 frame->direction = direction; … … 187 214 \param the keyframe to add 188 215 */ 189 void SimpleAnimation::addKeyFrame(KeyFrame * frame)216 void SimpleAnimation::addKeyFrame(KeyFrame3D* frame) 190 217 { 191 218 if( !this->bDescriptive || this->workingAnimator == NULL) … … 215 242 { 216 243 /* 217 tIterator<KeyFrame >* iterator = this->frames->getIterator();218 KeyFrame * frame = iterator->nextElement();244 tIterator<KeyFrame3D>* iterator = this->frames->getIterator(); 245 KeyFrame3D* frame = iterator->nextElement(); 219 246 while( frame != NULL) 220 247 { … … 225 252 delete this->frames; 226 253 227 this->frames = new tList<KeyFrame >();254 this->frames = new tList<KeyFrame3D>(); 228 255 this->localTime = 0; 229 256 this->bRunning = false; -
orxonox/trunk/src/simple_animation.h
r3847 r3848 13 13 #include "base_object.h" 14 14 #include "list.h" 15 #include "animation _player.h"15 #include "animation.h" 16 16 17 17 … … 30 30 This represents one point with direction of the animation 31 31 */ 32 typedef struct KeyFrame {32 typedef struct KeyFrame3D { 33 33 Vector* position; 34 34 Quaternion* direction; … … 42 42 This represents an animation for a object 43 43 */ 44 class Animation3D 44 class Animation3D : public Animation 45 45 { 46 46 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 47 74 WorldEntity* object; 48 75 Vector* lastPosition; … … 51 78 float localTime; 52 79 53 tList<KeyFrame >* frames;54 KeyFrame * currentFrame;55 KeyFrame * lastFrame;80 tList<KeyFrame3D>* frames; 81 KeyFrame3D* currentFrame; 82 KeyFrame3D* lastFrame; 56 83 57 84 bool bRunning; … … 75 102 void addKeyFrame(Vector* point, Quaternion* direction, float time); 76 103 void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode); 77 void addKeyFrame(KeyFrame * frame);104 void addKeyFrame(KeyFrame3D* frame); 78 105 void setAnimationMode(animationMode mode); 79 106 void reset(); … … 94 121 bool bDescriptive; //<! is true, when AnimatorBegin() was executed but no AnimatorEnd() yet: in describtive mode: pass commands 95 122 bool bRunning; //<! is set, when the animation is running 96 tList<KeyFrame >* frames; //<! where keyframes are stored in123 tList<KeyFrame3D>* frames; //<! where keyframes are stored in 97 124 tList<Animation3D>* animators; //<! a list of animation's 98 KeyFrame * currentFrame; //<! the frame that is been played now99 KeyFrame * lastFrame;125 KeyFrame3D* currentFrame; //<! the frame that is been played now 126 KeyFrame3D* lastFrame; 100 127 Vector* lastPosition; 101 128 movementMode mode; //<! this is an enum of the mode, how the speed is distributed -
orxonox/trunk/src/story_entities/world.cc
r3846 r3848 484 484 this->spawn(c); 485 485 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 */ 526 526 527 527 /*
Note: See TracChangeset
for help on using the changeset viewer.










