Changeset 3726 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 5, 2005, 6:34:33 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/simple_animation.cc
r3720 r3726 23 23 24 24 using namespace std; 25 26 /**27 \brief standard constructor28 \param the point of the object29 \param and the orientation of it30 \param at this time31 */32 KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time)33 {34 this->setRelCoor(point);35 this->setRelDir(orientation);36 this->time = time;37 }38 39 40 /**41 \brief standard constructor42 \param the point of the object43 \param and the orientation of it44 \param at this time45 \param function of the velocity of the movement46 */47 KeyFrame::KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)48 {49 this->setRelCoor(point);50 this->setRelDir(orientation);51 this->time = time;52 this->mode = mode;53 }54 55 56 /**57 \brief standard deconstructor58 */59 KeyFrame::~KeyFrame()60 {61 }62 63 64 /**65 \brief sets the important properties of a Keyframe66 \param the point of the object67 \param and the orientation of it68 \param at this time69 */70 void KeyFrame::set(Vector* point, Quaternion* orientation, float time)71 {72 this->setRelCoor(point);73 this->setRelDir(orientation);74 this->time = time;75 }76 77 78 /**79 \brief sets the important properties of a Keyframe80 \param the point of the object81 \param and the orientation of it82 \param at this time83 \param function of the velocity of the movement84 */85 void KeyFrame::set(Vector* point, Quaternion* orientation, float time, movementMode mode)86 {87 this->setRelCoor(point);88 this->setRelDir(orientation);89 this->time = time;90 this->mode = mode;91 }92 25 93 26 … … 137 70 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time) 138 71 { 139 KeyFrame* frame = new KeyFrame(point, orientation, time); 72 KeyFrame* frame = new KeyFrame; 73 frame->position = point; 74 frame->orientation = orientation; 75 frame->time = time; 76 frame->mode = DEFAULT_ANIMATION_MODE; 140 77 this->frames->add(frame); 141 78 } … … 151 88 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode) 152 89 { 153 KeyFrame* frame = new KeyFrame(point, orientation, time, mode); 90 KeyFrame* frame = new KeyFrame; 91 frame->position = point; 92 frame->orientation = orientation; 93 frame->time = time; 94 frame->mode = mode; 154 95 this->frames->add(frame); 155 96 } … … 267 208 case LINEAR: 268 209 269 *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();210 *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position; 270 211 *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time; 271 212 //this->setAbsCoordinate(this->tmpVect); … … 275 216 break; 276 217 case NEG_EXP: 277 *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();218 *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position; 278 219 *this->tmpVect = *this->tmpVect * (1 - exp(- this->localTime / this->currentFrame->time)); 279 220 break; 280 221 case SIN: 281 *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();222 *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position; 282 223 *this->tmpVect = *this->tmpVect * (1 - cos(- this->localTime / this->currentFrame->time)); 283 224 break; … … 286 227 break; 287 228 case QUADRATIC: 288 *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();229 *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position; 289 230 *this->tmpVect = *this->tmpVect * 1/3 * ldexpf(this->localTime, 3); 290 231 break; -
orxonox/trunk/src/simple_animation.h
r3720 r3726 12 12 13 13 #include "base_object.h" 14 #include "p_node.h"15 14 #include "list.h" 16 15 17 16 17 class Vector; 18 class Quaternion; 19 class WorldEntity; 20 class PNode; 21 18 22 typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC}; 23 #define DEFAULT_ANIMATION_MODE LINEAR 19 24 20 21 //! KeyFrame Class 25 //! KeyFrame Struct 22 26 /** 23 27 This represents one point with orientation of the animation 24 28 */ 25 class KeyFrame : public PNode { 26 public: 27 KeyFrame(Vector* point, Quaternion* orientation, float time); 28 KeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode); 29 virtual ~KeyFrame(); 30 31 void set(Vector* point, Quaternion* orientation, float time); 32 void set(Vector* point, Quaternion* orientation, float time, movementMode mode); 33 29 typedef struct KeyFrame { 30 Vector* position; 31 Quaternion* orientation; 32 WorldEntity* object; 34 33 float time; 35 34 movementMode mode; … … 69 68 PNode* parent; 70 69 71 Vector* tmpVect; //<! this is the temporary vector save place 70 Vector* tmpVect; //<! this is the temporary vector save place - 72 71 73 72 };
Note: See TracChangeset
for help on using the changeset viewer.