Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3726 in orxonox.OLD


Ignore:
Timestamp:
Apr 5, 2005, 6:34:33 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: reimplemented, rescaled KeyFrame.

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/simple_animation.cc

    r3720 r3726  
    2323
    2424using namespace std;
    25 
    26 /**
    27    \brief standard constructor
    28    \param the point of the object
    29    \param and the orientation of it
    30    \param at this time
    31 */
    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 constructor
    42    \param the point of the object
    43    \param and the orientation of it
    44    \param at this time
    45    \param function of the velocity of the movement
    46 */
    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 deconstructor
    58 */
    59 KeyFrame::~KeyFrame()
    60 {
    61 }
    62 
    63 
    64 /**
    65    \brief sets the important properties of a Keyframe
    66    \param the point of the object
    67    \param and the orientation of it
    68    \param at this time
    69 */
    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 Keyframe
    80    \param the point of the object
    81    \param and the orientation of it
    82    \param at this time
    83    \param function of the velocity of the movement
    84 */
    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 }
    9225
    9326
     
    13770void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
    13871{
    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;
    14077  this->frames->add(frame);
    14178}
     
    15188void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
    15289{
    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;
    15495  this->frames->add(frame);
    15596}
     
    267208    case LINEAR:
    268209
    269       *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();
     210      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    270211      *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time;
    271212      //this->setAbsCoordinate(this->tmpVect);
     
    275216      break;
    276217    case NEG_EXP:
    277       *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();
     218      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    278219      *this->tmpVect = *this->tmpVect * (1 - exp(- this->localTime / this->currentFrame->time));     
    279220      break;
    280221    case SIN:
    281       *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();
     222      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    282223      *this->tmpVect = *this->tmpVect * (1 - cos(- this->localTime / this->currentFrame->time));     
    283224      break;
     
    286227      break;
    287228    case QUADRATIC:
    288       *this->tmpVect = this->currentFrame->getAbsCoor() - this->lastFrame->getAbsCoor();     
     229      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    289230      *this->tmpVect = *this->tmpVect * 1/3 * ldexpf(this->localTime, 3);
    290231      break;
  • orxonox/trunk/src/simple_animation.h

    r3720 r3726  
    1212
    1313#include "base_object.h"
    14 #include "p_node.h"
    1514#include "list.h"
    1615
    1716
     17class Vector;
     18class Quaternion;
     19class WorldEntity;
     20class PNode;
     21
    1822typedef enum movementMode{LINEAR=0, EXP, NEG_EXP, SIN, COS, QUADRATIC};
     23#define DEFAULT_ANIMATION_MODE LINEAR
    1924
    20 
    21 //! KeyFrame Class
     25//! KeyFrame Struct
    2226/**
    2327   This represents one point with orientation of the animation
    2428*/
    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  
     29typedef struct KeyFrame {
     30  Vector* position;
     31  Quaternion* orientation;
     32  WorldEntity* object;
    3433  float time;
    3534  movementMode mode;
     
    6968  PNode* parent;
    7069 
    71   Vector* tmpVect;                 //<! this is the temporary vector save place
     70  Vector* tmpVect;                 //<! this is the temporary vector save place -
    7271
    7372};
Note: See TracChangeset for help on using the changeset viewer.