Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3852 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Apr 17, 2005, 1:39:10 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: new Animation3D is now ready for setting up of the Functions

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/animation.h

    r3851 r3852  
    4949  virtual void rewind() = 0;
    5050
    51   virtual void tick(float timePassed) = 0;
     51  virtual void tick(float dt) = 0;
    5252
    5353  /* implement in subclasses:
  • orxonox/trunk/src/animation3d.cc

    r3851 r3852  
    2727
    2828
    29 Animation3D::Animation3D(void)
    30 {
     29Animation3D::Animation3D(PNode* object)
     30{
     31  this->object = object;
     32
    3133  // create a new List
    3234  this->keyFrameList = new tList<KeyFrame3D>();
     
    9597}
    9698
    97 void Animation3D::tick(float timePassed)
     99void Animation3D::tick(float dt)
    98100{
    99101  if (this->bRunning)
    100102    {
    101       this->localTime += timePassed;
     103      this->localTime += dt;
    102104      if (localTime >= this->currentKeyFrame->duration)
    103105        {
     
    201203}
    202204
    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 }
     205void 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
     217void 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
     224void Animation3D::sine(float timePassed) const
     225{
     226
     227}
     228
     229void Animation3D::cosine(float timePassed) const
     230{
     231
     232}
     233
     234void Animation3D::exp(float timePassed) const
     235{
     236
     237}
     238
     239void Animation3D::negExp(float timePassed) const
     240{
     241
     242}
     243
     244void Animation3D::quadratic(float timePassed) const
     245{
     246
     247}
     248
     249void Animation3D::random(float timePassed) const
     250{
     251
     252}
  • orxonox/trunk/src/animation3d.h

    r3851 r3852  
    2626{
    2727 public:
    28   Animation3D(void);
     28  Animation3D(PNode* object);
    2929  virtual ~Animation3D(void);
    3030   
     
    3434  void addKeyFrame(KeyFrame3D* frame);
    3535
    36   virtual void tick(float timePassed);
     36  virtual void tick(float dt);
    3737
    3838  // animation functions
     
    4040
    4141 private:
    42   float constant(float timePassed) const;
    43   float linear(float timePassed) const;
    44   float sine(float timePassed) const;
    45   float cosine(float timePassed) const;
    46   float exp(float timePassed) const;
    47   float negExp(float timePassed) const;
    48   float quadratic(float timePassed) const;
    49   float random(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;
    5050  //  ANIM_FUNCTION animFunc;
    5151  KeyFrame3D* currentKeyFrame;
    5252  KeyFrame3D* nextKeyFrame;
    5353  tList<KeyFrame3D>* keyFrameList;
    54   float (Animation3D::*animFunc)(float) const;
     54  void (Animation3D::*animFunc)(float) const;
    5555
    5656  // more class-local description
  • orxonox/trunk/src/t_animation.h

    r3851 r3852  
    3636  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
    3737
    38   virtual void tick(float timePassed);
     38  virtual void tick(float dt);
    3939
    4040  // animation functions
     
    154154
    155155template<class T>
    156 void tAnimation<T>::tick(float timePassed)
     156void tAnimation<T>::tick(float dt)
    157157{
    158158  if (this->bRunning)
    159159    {
    160       this->localTime += timePassed;
     160      this->localTime += dt;
    161161      if (localTime >= this->currentKeyFrame->duration)
    162162        {
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3851 r3852  
    5353
    5454
    55   this->animaton = new Animation3D;
    5655  this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon
     56  this->animaton = new Animation3D(dummy1);
     57
    5758  /*
    5859  parent->addChild(this->dummy1, PNODE_ALL);
Note: See TracChangeset for help on using the changeset viewer.