Changeset 3855 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Apr 17, 2005, 2:46:27 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation3d.cc
r3853 r3855 20 20 #include "animation3d.h" 21 21 22 #include "stdincl.h"23 #include "vector.h"24 22 #include "p_node.h" 25 23 26 24 using namespace std; 27 25 28 26 /** 27 \brief standard constructor 28 */ 29 29 Animation3D::Animation3D(PNode* object) 30 30 { … … 44 44 } 45 45 46 /** 47 \brief standard deconstructor 48 49 deletes all the Keyframes 50 */ 46 51 Animation3D::~Animation3D(void) 47 52 { … … 58 63 } 59 64 60 65 /** 66 \brief rewinds the Animation to the beginning (first KeyFrame and time == 0) 67 */ 61 68 void Animation3D::rewind(void) 62 69 { … … 66 73 } 67 74 68 69 void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration = 1.0, ANIM_FUNCTION animFunc) 75 /** 76 \brief Appends a new Keyframe 77 \param position The position of the new Keyframe 78 \param direction The direction of the new Keyframe. 79 \param duration The duration from the new KeyFrame to the next one 80 \param animFunc The function to animate between this keyFrame and the next one 81 */ 82 void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, ANIM_FUNCTION animFunc) 70 83 { 71 84 // some small check … … 97 110 } 98 111 112 /** 113 \brief ticks the Animation 114 \param dt how much time to tick 115 */ 99 116 void Animation3D::tick(float dt) 100 117 { … … 171 188 172 189 173 190 /** 191 \brief Sets The kind of Animation between this keyframe and the next one 192 \param animFunc The Type of Animation to set 193 */ 174 194 void Animation3D::setAnimFunc(ANIM_FUNCTION animFunc) 175 195 { … … 204 224 } 205 225 226 /** 227 \brief stays at the value of the currentKeyFrame 228 \param timePassed The time passed since this Keyframe began 229 */ 206 230 void Animation3D::constant(float timePassed) const 207 231 { … … 216 240 } 217 241 242 /** 243 \brief linear interpolation between this keyframe and the next one 244 \param timePassed The time passed since this Keyframe began 245 */ 218 246 void Animation3D::linear(float timePassed) const 219 247 { … … 223 251 } 224 252 253 /** 254 \brief a Sinusodial Interpolation between this keyframe and the next one 255 \param timePassed The time passed since this Keyframe began 256 */ 225 257 void Animation3D::sine(float timePassed) const 226 258 { … … 228 260 } 229 261 262 /** 263 \brief a cosine interpolation between this keyframe and the next one 264 \param timePassed The time passed since this Keyframe began 265 */ 230 266 void Animation3D::cosine(float timePassed) const 231 267 { … … 233 269 } 234 270 271 /** 272 \brief an exponential interpolation between this keyframe and the next one 273 \param timePassed The time passed since this Keyframe began 274 */ 235 275 void Animation3D::exp(float timePassed) const 236 276 { … … 238 278 } 239 279 280 /** 281 \brief a negative exponential interpolation between this keyframe and the next one 282 \param timePassed The time passed since this Keyframe began 283 */ 240 284 void Animation3D::negExp(float timePassed) const 241 285 { 242 243 } 244 286 this->linear(timePassed); 287 } 288 289 /** 290 \brief a quadratic interpolation between this keyframe and the next one 291 \param timePassed The time passed since this Keyframe began 292 */ 245 293 void Animation3D::quadratic(float timePassed) const 246 294 { … … 248 296 } 249 297 298 /** 299 \brief some random animation (fluctuating) 300 \param timePassed The time passed since this Keyframe began 301 */ 250 302 void Animation3D::random(float timePassed) const 251 303 { -
orxonox/trunk/src/animation3d.h
r3852 r3855 13 13 */ 14 14 typedef struct KeyFrame3D { 15 float duration; 16 Vector position; 17 Quaternion direction; 18 ANIM_FUNCTION animFunc; 15 float duration; //!< The duration of this KeyFrame 16 Vector position; //!< The position of this KeyFrame 17 Quaternion direction; //!< The direction of this KeyFrame 18 ANIM_FUNCTION animFunc; //!< with whitch function to iterate to the next KeyFrame3D 19 19 }; 20 20 … … 32 32 33 33 void addKeyFrame(Vector position, Quaternion direction, float time, ANIM_FUNCTION animFunc = ANIM_LINEAR); 34 void addKeyFrame(KeyFrame3D* frame);34 // void addKeyFrame(KeyFrame3D* frame); 35 35 36 36 virtual void tick(float dt); … … 49 49 void random(float timePassed) const; 50 50 // ANIM_FUNCTION animFunc; 51 KeyFrame3D* currentKeyFrame; 52 KeyFrame3D* nextKeyFrame; 53 tList<KeyFrame3D>* keyFrameList; 54 void (Animation3D::*animFunc)(float) const; 51 void (Animation3D::*animFunc)(float) const; //!< A Function for the AnimationType 52 53 KeyFrame3D* currentKeyFrame; //!< The current KeyFrame 54 KeyFrame3D* nextKeyFrame; //!< The KeyFrame we iterate to 55 tList<KeyFrame3D>* keyFrameList; //!< The KeyFrameList 55 56 56 57 // more class-local description 57 PNode* object; 58 Vector lastPosition; 59 Vector tmpVect; 60 float deltaT; 58 PNode* object; //!< The Object from which to Animate something 59 Vector lastPosition; //!< ?? 60 Vector tmpVect; //!< what for?? 61 float deltaT; //!< ?? 61 62 }; -
orxonox/trunk/src/t_animation.h
r3854 r3855 54 54 // ANIM_FUNCTION animFunc; 55 55 float (tAnimation<T>::*animFunc)(float) const; //!< A Function for the AnimationType 56 56 57 KeyFrameF* currentKeyFrame; //!< The current KeyFrame 57 58 KeyFrameF* nextKeyFrame; //!< The KeyFrame we iterate to … … 247 248 248 249 // animation functions 249 250 /**251 \brief some random animation (fluctuating)252 \param timePassed The time passed since this Keyframe began253 */254 template<class T>255 float tAnimation<T>::random(float timePassed) const256 {257 return this->currentKeyFrame->value * (float)rand()/(float)RAND_MAX;258 }259 260 250 /** 261 251 \brief stays at the value of the currentKeyFrame … … 345 335 } 346 336 337 /** 338 \brief some random animation (fluctuating) 339 \param timePassed The time passed since this Keyframe began 340 */ 341 template<class T> 342 float tAnimation<T>::random(float timePassed) const 343 { 344 return this->currentKeyFrame->value * (float)rand()/(float)RAND_MAX; 345 } 347 346 348 347 #endif /* _T_ANIMATION_H */ -
orxonox/trunk/src/world_entities/test_gun.cc
r3852 r3855 54 54 55 55 this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 56 this->animaton = new Animation3D(dummy1); 57 56 this->animation = new Animation3D(dummy1); 57 58 parent->addChild(this->dummy1, PNODE_ALL); 59 60 this->animation->setInfinity(ANIM_INF_CONSTANT); 61 // ANIM_LINEAR was ANIM_NEG_EXP 62 if( this->leftRight == 0) 63 { 64 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 65 this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR); 66 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 67 } 68 else if( this->leftRight == 1) 69 { 70 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 71 this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR); 72 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 73 } 58 74 /* 59 parent->addChild(this->dummy1, PNODE_ALL); 60 61 62 this->animator->animatorBegin(); 63 this->animator->selectObject(this->dummy1); 64 this->animator->setAnimationMode(SINGLE); 65 if( this->leftRight == 0) 66 { 67 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.0, NEG_EXP); 68 this->animator->addKeyFrame(new Vector(-3.0, 0.1, 3.0), new Quaternion(), 0.1, NEG_EXP); 69 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.5, NEG_EXP); 70 } 71 else if( this->leftRight == 1) 72 { 73 this->animator->addKeyFrame(new Vector(-2.6, 0.1, -2.5), new Quaternion(), 0.0, NEG_EXP); 74 this->animator->addKeyFrame(new Vector(-3.0, 0.1, -2.5), new Quaternion(), 0.1, NEG_EXP); 75 this->animator->addKeyFrame(new Vector(-2.6, 0.1, -2.5), new Quaternion(), 0.5, NEG_EXP); 76 } 77 this->animator->animatorEnd(); 75 if( this->leftRight == 0) 76 { 77 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.0, ANIM_NEG_EXP); 78 this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.1, ANIM_NEG_EXP); 79 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.5, ANIM_NEG_EXP); 80 } 81 else if( this->leftRight == 1) 82 { 83 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.0, ANIM_NEG_EXP); 84 this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP); 85 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.5, ANIM_NEG_EXP); 86 } 78 87 */ 79 88 } … … 134 143 this->localTime = 0; 135 144 136 /* 137 this->animator->animatorBegin(); 138 this->animator->selectObject(this->dummy1); 139 this->animator->start(); 140 this->animator->animatorEnd(); 141 */ 145 this->animation->replay(); 142 146 } 143 147 -
orxonox/trunk/src/world_entities/test_gun.h
r3851 r3855 52 52 53 53 private: 54 Animation3D* animat on;54 Animation3D* animation; 55 55 Vector* projOffset; 56 56 WorldEntity* dummy1;
Note: See TracChangeset
for help on using the changeset viewer.