Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3967 in orxonox.OLD


Ignore:
Timestamp:
Apr 26, 2005, 12:31:54 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: animation3d now ANIM_COSINE works also

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r3965 r3967  
    471471            c->setRelCoor(Vector(10.0, 2.0, -1.0));
    472472            this->spawn(c);
    473            
     473
     474
    474475           
    475476            Animation3D* animation = new Animation3D(c);
    476477            animation->setInfinity(ANIM_INF_REPLAY);
    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);
     478            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_COSINE);
     479            animation->addKeyFrame(Vector(1, 1, -1), Quaternion(), 1.0, ANIM_COSINE);
     480            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(), 1.0, ANIM_COSINE);
     481
     482
     483
    480484
    481485
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3965 r3967  
    271271
    272272
     273/**
     274   \brief a cosine interpolation between this keyframe and the next one
     275   \param timePassed The time passed since this Keyframe began
     276
     277   \todo implement
     278*/
     279void Animation3D::cosine(float timePassed) const
     280{
     281  this->object->setRelCoor( this->nextKeyFrame->position -
     282                            (this->nextKeyFrame->position - this->currentKeyFrame->position) *
     283                            (1.0 + cos( M_PI * timePassed / this->currentKeyFrame->duration))/2.0);
     284
     285}
     286
     287
    273288/*
    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 */
    289 void Animation3D::cosine(float timePassed) const
    290 {
    291   this->linear(timePassed);
    292 }
     289 return ((this->nextKeyFrame->value + this->currentKeyFrame->value) +
     290    (this->currentKeyFrame->value - this->nextKeyFrame->value) *
     291    cos( M_PI * timePassed / this->currentKeyFrame->duration))/2;
     292*/
    293293
    294294/**
Note: See TracChangeset for help on using the changeset viewer.