Changeset 3784 in orxonox.OLD for orxonox/branches/textEngine/src/animation.cc
- Timestamp:
- Apr 13, 2005, 12:24:05 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/textEngine/src/animation.cc
r3782 r3784 17 17 #include "animation.h" 18 18 #include "debug.h" 19 #include "list.h" 19 20 20 21 21 22 Anim::Anim(void) 22 23 { 24 // create a new List 25 this->keyFrameList = new tList<AnimKeyFrame>(); 26 27 // initialize a beginning KeyFrame, that will be deleted afterwards 28 this->bHasKeys = false; 29 30 31 this->animFunc = &Anim::random; 23 32 } 24 33 25 34 35 Anim::~Anim(void) 36 { 37 // delete all the KeyFrames 38 tIterator<AnimKeyFrame>* itKF = keyFrameList->getIterator(); 39 AnimKeyFrame* enumKF = itKF->nextElement(); 40 while (enumKF) 41 { 42 delete enumKF; 43 enumKF = itKF->nextElement(); 44 } 45 delete itKF; 46 delete this->keyFrameList; 47 } 48 26 49 tList<Anim>* Anim::animatorList = NULL; 50 51 52 void Anim::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc) 53 { 54 if (!bHasKeys) 55 { 56 this->keyFrameList->remove(this->keyFrameList->firstElement()); 57 bHasKeys = true; 58 } 59 AnimKeyFrame* tmpKeyFrame = new AnimKeyFrame; 60 tmpKeyFrame->value = value; 61 tmpKeyFrame->duration = duration; 62 tmpKeyFrame->animFunc = animFunc; 63 64 this->keyFrameList->add(tmpKeyFrame); 65 } 66 67 void Anim::setInfinity(ANIM_INFINITY preInfinity, ANIM_INFINITY postInfinity) 68 { 69 this->preInfinity = preInfinity; 70 this->postInfinity = postInfinity; 71 } 72 73 void Anim::setAnimFunc(ANIM_FUNCTION animFunc) 74 { 75 switch (animFunc) 76 { 77 default: 78 case ANIM_CONSTANT: 79 this->animFunc = &Anim::constant; 80 break; 81 case ANIM_LINEAR: 82 this->animFunc = &Anim::linear; 83 break; 84 case ANIM_RANDOM: 85 this->animFunc = &Anim::random; 86 break; 87 case ANIM_SINE: 88 this->animFunc = &Anim::sine; 89 break; 90 91 } 92 } 93 94 95 // animation functions 96 float Anim::random(float time) 97 { 98 return (float)rand()/(float)RAND_MAX; 99 } 100 101 float Anim::constant(float time) 102 { 103 104 } 105 106 float Anim::linear(float time) 107 { 108 109 } 110 111 float Anim::sine(float time) 112 { 113 114 }
Note: See TracChangeset
for help on using the changeset viewer.