Changeset 3852 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 17, 2005, 1:39:10 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation.h
r3851 r3852 49 49 virtual void rewind() = 0; 50 50 51 virtual void tick(float timePassed) = 0;51 virtual void tick(float dt) = 0; 52 52 53 53 /* implement in subclasses: -
orxonox/trunk/src/animation3d.cc
r3851 r3852 27 27 28 28 29 Animation3D::Animation3D(void) 30 { 29 Animation3D::Animation3D(PNode* object) 30 { 31 this->object = object; 32 31 33 // create a new List 32 34 this->keyFrameList = new tList<KeyFrame3D>(); … … 95 97 } 96 98 97 void Animation3D::tick(float timePassed)99 void Animation3D::tick(float dt) 98 100 { 99 101 if (this->bRunning) 100 102 { 101 this->localTime += timePassed;103 this->localTime += dt; 102 104 if (localTime >= this->currentKeyFrame->duration) 103 105 { … … 201 203 } 202 204 203 float Animation3D::constant(float timePassed) const 204 { 205 206 } 207 208 float Animation3D::linear(float timePassed) const 209 { 210 211 } 212 213 float Animation3D::sine(float timePassed) const 214 { 215 216 } 217 218 float Animation3D::cosine(float timePassed) const 219 { 220 221 } 222 223 float Animation3D::exp(float timePassed) const 224 { 225 226 } 227 228 float Animation3D::negExp(float timePassed) const 229 { 230 231 } 232 233 float Animation3D::quadratic(float timePassed) const 234 { 235 236 } 237 238 float Animation3D::random(float timePassed) const 239 { 240 241 } 205 void Animation3D::constant(float timePassed) const 206 { 207 this->object->setRelCoor(this->currentKeyFrame->position); 208 209 /* 210 this->tmpVect = this->nextKeyFrame->position - this->currentKeyFrame->position; 211 this->tmpVect = this->tmpVect * this->localTime / this->currentKeyFrame->duration; 212 this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect); 213 this->lastPosition = this->tmpVect; 214 */ 215 } 216 217 void Animation3D::linear(float timePassed) const 218 { 219 this->object->setRelCoor(this->currentKeyFrame->position + 220 (this->nextKeyFrame->position - this->currentKeyFrame->position) * 221 (timePassed/this->currentKeyFrame->duration)); 222 } 223 224 void Animation3D::sine(float timePassed) const 225 { 226 227 } 228 229 void Animation3D::cosine(float timePassed) const 230 { 231 232 } 233 234 void Animation3D::exp(float timePassed) const 235 { 236 237 } 238 239 void Animation3D::negExp(float timePassed) const 240 { 241 242 } 243 244 void Animation3D::quadratic(float timePassed) const 245 { 246 247 } 248 249 void Animation3D::random(float timePassed) const 250 { 251 252 } -
orxonox/trunk/src/animation3d.h
r3851 r3852 26 26 { 27 27 public: 28 Animation3D( void);28 Animation3D(PNode* object); 29 29 virtual ~Animation3D(void); 30 30 … … 34 34 void addKeyFrame(KeyFrame3D* frame); 35 35 36 virtual void tick(float timePassed);36 virtual void tick(float dt); 37 37 38 38 // animation functions … … 40 40 41 41 private: 42 floatconstant(float timePassed) const;43 floatlinear(float timePassed) const;44 floatsine(float timePassed) const;45 floatcosine(float timePassed) const;46 floatexp(float timePassed) const;47 floatnegExp(float timePassed) const;48 floatquadratic(float timePassed) const;49 floatrandom(float timePassed) const;42 void constant(float timePassed) const; 43 void linear(float timePassed) const; 44 void sine(float timePassed) const; 45 void cosine(float timePassed) const; 46 void exp(float timePassed) const; 47 void negExp(float timePassed) const; 48 void quadratic(float timePassed) const; 49 void random(float timePassed) const; 50 50 // ANIM_FUNCTION animFunc; 51 51 KeyFrame3D* currentKeyFrame; 52 52 KeyFrame3D* nextKeyFrame; 53 53 tList<KeyFrame3D>* keyFrameList; 54 float(Animation3D::*animFunc)(float) const;54 void (Animation3D::*animFunc)(float) const; 55 55 56 56 // more class-local description -
orxonox/trunk/src/t_animation.h
r3851 r3852 36 36 void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR); 37 37 38 virtual void tick(float timePassed);38 virtual void tick(float dt); 39 39 40 40 // animation functions … … 154 154 155 155 template<class T> 156 void tAnimation<T>::tick(float timePassed)156 void tAnimation<T>::tick(float dt) 157 157 { 158 158 if (this->bRunning) 159 159 { 160 this->localTime += timePassed;160 this->localTime += dt; 161 161 if (localTime >= this->currentKeyFrame->duration) 162 162 { -
orxonox/trunk/src/world_entities/test_gun.cc
r3851 r3852 53 53 54 54 55 this->animaton = new Animation3D;56 55 this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 56 this->animaton = new Animation3D(dummy1); 57 57 58 /* 58 59 parent->addChild(this->dummy1, PNODE_ALL);
Note: See TracChangeset
for help on using the changeset viewer.