Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3965 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Apr 26, 2005, 12:08:46 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: animation3d ANIM_SINE is now finaly working also. looks nice

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r3964 r3965  
    475475            Animation3D* animation = new Animation3D(c);
    476476            animation->setInfinity(ANIM_INF_REPLAY);
    477             animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_NEG_EXP);
    478             animation->addKeyFrame(Vector(5, 5, -5), Quaternion(), 1.0, ANIM_NEG_EXP);
    479             animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_NEG_EXP);
     477            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_SINE);
     478            animation->addKeyFrame(Vector(1, 1, -1), Quaternion(), 1.0, ANIM_SINE);
     479            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_SINE);
    480480
    481481
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3964 r3965  
    262262void Animation3D::sine(float timePassed) const
    263263{
     264  if( timePassed  < this->currentKeyFrame->duration/2.0)
     265    this->object->setRelCoor( this->currentKeyFrame->position + (this->nextKeyFrame->position - this->currentKeyFrame->position) *
     266                              sin( M_PI * timePassed /this->currentKeyFrame->duration) / 2.0);
     267  else
     268    this->object->setRelCoor( this->nextKeyFrame->position - (this->nextKeyFrame->position - this->currentKeyFrame->position) *
     269                              sin( M_PI * (1.0 - timePassed /this->currentKeyFrame->duration) )/2.0);
     270}
     271
     272
     273/*
     274  if (timePassed * 2.0 < this->currentKeyFrame->duration)
     275    return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value)
     276      * sin( M_PI * timePassed / this->currentKeyFrame->duration)/2;
     277  else
     278    return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value)
     279      * sin( M_PI * (1.0 - timePassed / this->currentKeyFrame->duration))/2;
     280
     281*/
     282
     283/**
     284   \brief a cosine interpolation between this keyframe and the next one
     285   \param timePassed The time passed since this Keyframe began
     286
     287   \todo implement
     288*/
     289void Animation3D::cosine(float timePassed) const
     290{
    264291  this->linear(timePassed);
    265292}
    266293
    267294/**
    268    \brief a cosine interpolation between this keyframe and the next one
    269    \param timePassed The time passed since this Keyframe began
    270 
    271    \todo implement
    272 */
    273 void Animation3D::cosine(float timePassed) const
     295   \brief an exponential interpolation between this keyframe and the next one
     296   \param timePassed The time passed since this Keyframe began
     297*/
     298void Animation3D::exp(float timePassed) const
    274299{
    275300  this->linear(timePassed);
     
    277302
    278303/**
    279    \brief an exponential interpolation between this keyframe and the next one
    280    \param timePassed The time passed since this Keyframe began
    281 */
    282 void Animation3D::exp(float timePassed) const
    283 {
    284   this->linear(timePassed);
    285 }
    286 
    287 /**
    288304   \brief a negative exponential interpolation between this keyframe and the next one
    289305   \param timePassed The time passed since this Keyframe began
    290 
    291    \todo implement
    292306*/
    293307void Animation3D::negExp(float timePassed) const
     
    297311                            (1.0 - expf(- timePassed * expFactor)) );
    298312}
    299 
    300 /*
    301   float d = this->currentKeyFrame->value - this->nextKeyFrame->value;
    302   float e = d * (1.0 - expf(- timePassed * expFactor));
    303   return  this->currentKeyFrame->value - e;
    304 */
    305313
    306314
Note: See TracChangeset for help on using the changeset viewer.