Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4998 in orxonox.OLD for orxonox/trunk/src/util


Ignore:
Timestamp:
Aug 13, 2005, 7:19:51 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more optimizations of the Quaternion Class.
Now the 3D-rotation is much faster through this code:

Vector tmpRot = this→getAbsDir().getSpacialAxis();
glRotatef (this→getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );

instead of the old Matrix-approach. furthermore glRotate is optimized much better in openGL as is clearly stated in the red book

also implemented some other really useless functions for Quaternion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/animation/animation3d.cc

    r4836 r4998  
    401401void Animation3D::rLinear(float timePassed) const
    402402{
    403   this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction,
    404                                      this->currentKeyFrame->direction,
    405                                      timePassed/this->currentKeyFrame->duration) );
     403  this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction,
     404                          this->currentKeyFrame->direction,
     405                          timePassed/this->currentKeyFrame->duration) );
    406406}
    407407
     
    420420    scale = 1.0 - sin( M_PI * timePassed / this->currentKeyFrame->duration);
    421421
    422   this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction,
    423                                      this->currentKeyFrame->direction,
    424                                      scale) );
     422  this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction,
     423                          this->currentKeyFrame->direction,
     424                          scale) );
    425425}
    426426
     
    435435{
    436436  float scale = cos(M_PI * timePassed / this->currentKeyFrame->duration);
    437   this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction,
    438                                      this->currentKeyFrame->direction,
    439                                      scale) );
     437  this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction,
     438                          this->currentKeyFrame->direction,
     439                          scale) );
    440440}
    441441
     
    458458{
    459459  float scale = (1.0 - expf(- timePassed * expFactorRot));
    460   this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction,
    461                                      this->currentKeyFrame->direction,
    462                                      scale) );
     460  this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction,
     461                          this->currentKeyFrame->direction,
     462                          scale) );
    463463}
    464464
Note: See TracChangeset for help on using the changeset viewer.