Changeset 3847 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 17, 2005, 2:01:28 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation.cc
r3833 r3847 20 20 21 21 22 Anim ::Anim(void)22 Animation::Animation(void) 23 23 { 24 24 // initialize a beginning KeyFrame, that will be deleted afterwards … … 34 34 } 35 35 36 Anim ::~Anim(void)36 Animation::~Animation(void) 37 37 { 38 38 this->doNotHandle(); 39 39 } 40 40 41 void Anim ::doNotHandle(void)41 void Animation::doNotHandle(void) 42 42 { 43 43 if (this->bHandled) … … 46 46 47 47 48 void Anim ::setInfinity(ANIM_INFINITY postInfinity)48 void Animation::setInfinity(ANIM_INFINITY postInfinity) 49 49 { 50 50 this->postInfinity = postInfinity; … … 52 52 53 53 54 void Anim ::play()54 void Animation::play() 55 55 { 56 56 this->bRunning = true; … … 58 58 59 59 60 void Anim ::stop()60 void Animation::stop() 61 61 { 62 62 this->rewind(); … … 65 65 this->bRunning = false; 66 66 } 67 void Anim ::pause()67 void Animation::pause() 68 68 { 69 69 this->bRunning = false; 70 70 } 71 void Anim ::replay()71 void Animation::replay() 72 72 { 73 73 this->rewind(); -
orxonox/trunk/src/animation.h
r3846 r3847 55 55 }; 56 56 57 class Anim 57 class Animation 58 58 { 59 59 public: 60 virtual ~Anim (void);60 virtual ~Animation(void); 61 61 void doNotHandle(void); 62 62 … … 87 87 88 88 protected: 89 Anim (void);89 Animation(void); 90 90 91 91 // variables … … 102 102 103 103 //! A Class to handle some animation for single floated values. 104 template<class T> class tAnim : public Anim104 template<class T> class tAnimation : public Animation 105 105 { 106 106 public: 107 tAnim (T* object = NULL, void (T::*funcToAnim)(float) = NULL);108 virtual ~tAnim ();107 tAnimation(T* object = NULL, void (T::*funcToAnim)(float) = NULL); 108 virtual ~tAnimation(); 109 109 110 110 virtual void rewind(); … … 127 127 float random(float timePassed) const; 128 128 // ANIM_FUNCTION animFunc; 129 float (tAnim <T>::*animFunc)(float) const;129 float (tAnimation<T>::*animFunc)(float) const; 130 130 AnimKeyFrame* currentKeyFrame; 131 131 AnimKeyFrame* nextKeyFrame; … … 148 148 */ 149 149 template<class T> 150 tAnim <T>::tAnim(T* object, void (T::*funcToAnim)(float))150 tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 151 151 { 152 152 // create a new List … … 160 160 this->nextKeyFrame = tmpKeyFrame; 161 161 162 this->animFunc = &tAnim <T>::linear;162 this->animFunc = &tAnimation<T>::linear; 163 163 164 164 this->setFuncToAnim(object, funcToAnim); … … 171 171 */ 172 172 template<class T> 173 tAnim <T>::~tAnim()173 tAnimation<T>::~tAnimation () 174 174 { 175 175 // delete all the KeyFrames … … 187 187 188 188 template<class T> 189 void tAnim <T>::rewind(void)189 void tAnimation<T>::rewind(void) 190 190 { 191 191 this->currentKeyFrame = keyFrameList->firstElement(); … … 195 195 196 196 template<class T> 197 void tAnim <T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float))197 void tAnimation<T>::setFuncToAnim(T* object, void (T::*funcToAnim)(float)) 198 198 { 199 199 this->baseObject = this->object = object; … … 202 202 203 203 template<class T> 204 void tAnim <T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc)204 void tAnimation<T>::addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc) 205 205 { 206 206 // some small check … … 232 232 233 233 template<class T> 234 void tAnim <T>::tick(float time)234 void tAnimation<T>::tick(float time) 235 235 { 236 236 if (this->bRunning) … … 265 265 266 266 template<class T> 267 void tAnim <T>::setAnimFunc(ANIM_FUNCTION animFunc)267 void tAnimation<T>::setAnimFunc(ANIM_FUNCTION animFunc) 268 268 { 269 269 switch (animFunc) … … 271 271 default: 272 272 case ANIM_CONSTANT: 273 this->animFunc = &tAnim <T>::constant;273 this->animFunc = &tAnimation<T>::constant; 274 274 break; 275 275 case ANIM_LINEAR: 276 this->animFunc = &tAnim <T>::linear;276 this->animFunc = &tAnimation<T>::linear; 277 277 break; 278 278 case ANIM_SINE: 279 this->animFunc = &tAnim <T>::sine;279 this->animFunc = &tAnimation<T>::sine; 280 280 break; 281 281 case ANIM_COSINE: 282 this->animFunc = &tAnim <T>::cosine;282 this->animFunc = &tAnimation<T>::cosine; 283 283 break; 284 284 case ANIM_EXP: 285 this->animFunc = &tAnim <T>::exp;285 this->animFunc = &tAnimation<T>::exp; 286 286 break; 287 287 case ANIM_NEG_EXP: 288 288 { 289 this->animFunc = &tAnim <T>::negExp;289 this->animFunc = &tAnimation<T>::negExp; 290 290 float d = fabs(this->currentKeyFrame->value - this->nextKeyFrame->value); 291 291 expFactor = - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X); … … 293 293 } 294 294 case ANIM_QUADRATIC: 295 this->animFunc = &tAnim <T>::quadratic;295 this->animFunc = &tAnimation<T>::quadratic; 296 296 break; 297 297 case ANIM_RANDOM: 298 this->animFunc = &tAnim <T>::random;298 this->animFunc = &tAnimation<T>::random; 299 299 break; 300 300 } … … 304 304 // animation functions 305 305 template<class T> 306 float tAnim <T>::random(float timePassed) const306 float tAnimation<T>::random(float timePassed) const 307 307 { 308 308 return (float)rand()/(float)RAND_MAX; … … 310 310 311 311 template<class T> 312 float tAnim <T>::constant(float timePassed) const312 float tAnimation<T>::constant(float timePassed) const 313 313 { 314 314 return this->currentKeyFrame->value; … … 316 316 317 317 template<class T> 318 float tAnim <T>::linear(float timePassed) const318 float tAnimation<T>::linear(float timePassed) const 319 319 { 320 320 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) … … 325 325 326 326 template<class T> 327 float tAnim <T>::sine(float timePassed) const327 float tAnimation<T>::sine(float timePassed) const 328 328 { 329 329 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; … … 337 337 338 338 template<class T> 339 float tAnim <T>::cosine(float timePassed) const339 float tAnimation<T>::cosine(float timePassed) const 340 340 { 341 341 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; … … 350 350 351 351 template<class T> 352 float tAnim <T>::exp(float timePassed) const353 { 354 } 355 356 template<class T> 357 float tAnim <T>::negExp(float timePassed) const352 float tAnimation<T>::exp(float timePassed) const 353 { 354 } 355 356 template<class T> 357 float tAnimation<T>::negExp(float timePassed) const 358 358 { 359 359 float d = this->currentKeyFrame->value - this->nextKeyFrame->value; … … 363 363 364 364 template<class T> 365 float tAnim <T>::quadratic(float timePassed) const365 float tAnimation<T>::quadratic(float timePassed) const 366 366 { 367 367 -
orxonox/trunk/src/animation_player.cc
r3833 r3847 28 28 this->setClassName ("AnimationPlayer"); 29 29 30 this->animationList = new tList<Anim >();30 this->animationList = new tList<Animation>(); 31 31 this->play(); 32 32 } … … 72 72 unadding it with animation->notHandled(); 73 73 */ 74 void AnimationPlayer::addAnimation(Anim * animation)74 void AnimationPlayer::addAnimation(Animation* animation) 75 75 { 76 76 this->animationList->add(animation); … … 81 81 \param animation the Anmination to remove from the List 82 82 */ 83 void AnimationPlayer::removeAnimation(Anim * animation)83 void AnimationPlayer::removeAnimation(Animation* animation) 84 84 { 85 85 this->animationList->remove(animation); … … 92 92 { 93 93 // deleting the Animation List AND all the elements of the List 94 tIterator<Anim >* animIt = this->animationList->getIterator();95 Anim * anim = animIt->nextElement();94 tIterator<Animation>* animIt = this->animationList->getIterator(); 95 Animation* anim = animIt->nextElement(); 96 96 while( anim != NULL) 97 97 { … … 103 103 104 104 delete this->animationList; 105 this->animationList = new tList<Anim >();105 this->animationList = new tList<Animation>(); 106 106 } 107 107 … … 115 115 { 116 116 // iterate through all the animations and tick them. 117 tIterator<Anim >* animIt = this->animationList->getIterator();118 Anim * anim = animIt->nextElement();117 tIterator<Animation>* animIt = this->animationList->getIterator(); 118 Animation* anim = animIt->nextElement(); 119 119 while( anim != NULL) 120 120 { … … 142 142 143 143 144 Anim * AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const144 Animation* AnimationPlayer::getObjectFromBaseObject(const BaseObject* baseObject) const 145 145 { 146 tIterator<Anim >* animIt = this->animationList->getIterator();147 Anim * anim = animIt->nextElement();146 tIterator<Animation>* animIt = this->animationList->getIterator(); 147 Animation* anim = animIt->nextElement(); 148 148 while( anim != NULL) 149 149 { … … 173 173 PRINT(0)("-Animation Information---------------+\n"); 174 174 // Per ANIMATION DEBUG 175 tIterator<Anim >* animIt = this->animationList->getIterator();176 Anim * anim = animIt->nextElement();175 tIterator<Animation>* animIt = this->animationList->getIterator(); 176 Animation* anim = animIt->nextElement(); 177 177 while( anim != NULL) 178 178 { -
orxonox/trunk/src/animation_player.h
r3833 r3847 33 33 34 34 // animation handling 35 void addAnimation(Anim * animation);36 void removeAnimation(Anim * animation);35 void addAnimation(Animation* animation); 36 void removeAnimation(Animation* animation); 37 37 void flush(void); 38 38 … … 42 42 void pause(void); 43 43 44 Anim * getObjectFromBaseObject(const BaseObject* baseObject) const;44 Animation* getObjectFromBaseObject(const BaseObject* baseObject) const; 45 45 46 46 void debug(void); … … 52 52 53 53 /* class specific */ 54 tList<Anim >* animationList;//!< A List of Animations to be handled.54 tList<Animation>* animationList; //!< A List of Animations to be handled. 55 55 bool bRunning; //!< If the AnimationPlayer is running. 56 56 }; -
orxonox/trunk/src/simple_animation.cc
r3832 r3847 46 46 this->setClassName ("SimpleAnimation"); 47 47 this->frames = new tList<KeyFrame>(); 48 this->animators = new tList<Animation >();48 this->animators = new tList<Animation3D>(); 49 49 this->localTime = 0; 50 50 this->bRunning = false; … … 119 119 void SimpleAnimation::selectObject(WorldEntity* entity) 120 120 { 121 Animation * anim = getAnimationFromWorldEntity(entity);121 Animation3D* anim = getAnimationFromWorldEntity(entity); 122 122 if( anim == NULL) 123 123 { 124 anim = new Animation ;124 anim = new Animation3D; 125 125 anim->object = entity; 126 126 anim->lastPosition = new Vector(); … … 310 310 void SimpleAnimation::tick(float time) 311 311 { 312 tIterator<Animation >* iterator = this->animators->getIterator();313 Animation * anim = iterator->nextElement();312 tIterator<Animation3D>* iterator = this->animators->getIterator(); 313 Animation3D* anim = iterator->nextElement(); 314 314 while( anim != NULL) 315 315 { … … 383 383 384 384 385 Animation * SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)386 { 387 tIterator<Animation >* iterator = this->animators->getIterator();388 Animation * anim = iterator->nextElement();385 Animation3D* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity) 386 { 387 tIterator<Animation3D>* iterator = this->animators->getIterator(); 388 Animation3D* anim = iterator->nextElement(); 389 389 while( anim != NULL) 390 390 { -
orxonox/trunk/src/simple_animation.h
r3752 r3847 13 13 #include "base_object.h" 14 14 #include "list.h" 15 #include "animation_player.h" 15 16 16 17 … … 41 42 This represents an animation for a object 42 43 */ 43 typedef struct Animation { 44 44 class Animation3D 45 { 46 public: 45 47 WorldEntity* object; 46 48 Vector* lastPosition; … … 64 66 */ 65 67 class SimpleAnimation : public BaseObject { 66 67 68 public: 68 69 static SimpleAnimation* getInstance(); … … 94 95 bool bRunning; //<! is set, when the animation is running 95 96 tList<KeyFrame>* frames; //<! where keyframes are stored in 96 tList<Animation >* animators; //<! a list of animation's97 tList<Animation3D>* animators; //<! a list of animation's 97 98 KeyFrame* currentFrame; //<! the frame that is been played now 98 99 KeyFrame* lastFrame; … … 104 105 Vector* tmpVect; //<! this is the temporary vector save place - 105 106 WorldEntity* workingObject; //<! this is a pointer to the current working object that has been selected via selectObject() 106 Animation * workingAnimator; //<! the animator with which you are currently working107 Animation3D* workingAnimator; //<! the animator with which you are currently working 107 108 float deltaT; //<! this is a time constant for the movement 108 109 109 Animation * getAnimationFromWorldEntity(WorldEntity* entity);110 Animation3D* getAnimationFromWorldEntity(WorldEntity* entity); 110 111 111 112 }; -
orxonox/trunk/src/story_entities/world.h
r3812 r3847 99 99 GLMenuImageScreen* glmis; //!< The Level-Loader Display 100 100 101 Text* testText; //!< A text to Test the TextEngine;102 103 101 char* worldName; //!< The name of this World 104 102 int debugWorldNr; //!< The Debug Nr. needed, if something goes wrong -
orxonox/trunk/src/track_manager.cc
r3846 r3847 393 393 this->trackText->setAlignment(TEXT_ALIGN_SCREEN_CENTER); 394 394 // initializing the Animation for the Text. 395 this->textAnimation = new tAnim <Text>(this->trackText, &Text::setBlending);396 this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_ LINEAR);395 this->textAnimation = new tAnimation<Text>(this->trackText, &Text::setBlending); 396 this->textAnimation->addKeyFrame(1.0, 3.0, ANIM_NEG_EXP); 397 397 this->textAnimation->addKeyFrame(0.0, .001); 398 398 this->textAnimation->setInfinity(ANIM_INF_CONSTANT); -
orxonox/trunk/src/track_manager.h
r3845 r3847 18 18 class PNode; 19 19 class Text; 20 template<class T> class tAnim ;20 template<class T> class tAnimation; 21 21 template<class T> class tList; 22 22 … … 144 144 PNode* trackNode; //!< The main TrackNode of this Track. 145 145 Text* trackText; //!< The text to display when switching between Worlds. 146 tAnim <Text>* textAnimation;//!< An Animation for the Text.146 tAnimation<Text>* textAnimation; //!< An Animation for the Text. 147 147 148 148 void initChildren(unsigned int childCount, TrackElement* trackElem = NULL); -
orxonox/trunk/src/world_entities/test_gun.cc
r3757 r3847 52 52 this->projOffset = new Vector(1.0, 0.0, 0.5); 53 53 54 54 55 this->animator = SimpleAnimation::getInstance(); 55 this->dummy1 = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */ 56 this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 57 /* 56 58 parent->addChild(this->dummy1, PNODE_ALL); 57 59 … … 73 75 } 74 76 this->animator->animatorEnd(); 75 77 */ 76 78 } 77 79 … … 131 133 this->localTime = 0; 132 134 133 this->animator->animatorBegin(); 134 this->animator->selectObject(this->dummy1); 135 this->animator->start(); 136 this->animator->animatorEnd(); 135 /* 136 this->animator->animatorBegin(); 137 this->animator->selectObject(this->dummy1); 138 this->animator->start(); 139 this->animator->animatorEnd(); 140 */ 137 141 } 138 142
Note: See TracChangeset
for help on using the changeset viewer.