Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

Location:
orxonox/trunk/src/world_entities
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/camera.cc

    r4997 r4998  
    142142    case VIEW_FRONT:
    143143      this->toFovy = 120.0;
    144       this->softReparent("Player");
    145       this->target->softReparent("Player");
    146       this->setRelCoorSoft(4, 0, 0);
    147       this->target->setRelCoorSoft(10,0,0);
     144//       this->softReparent("Player");
     145//       this->target->softReparent("Player");
     146//       this->setRelCoorSoft(4, 0, 0);
     147//       this->target->setRelCoorSoft(10,0,0);
     148      this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0)));
    148149      break;
    149150    case VIEW_LEFT:
  • orxonox/trunk/src/world_entities/player.cc

    r4997 r4998  
    222222  glMatrixMode(GL_MODELVIEW);
    223223  glPushMatrix();
    224   float matrix[4][4];
    225 
    226224  /* translate */
    227225  glTranslatef (this->getAbsCoor ().x,
     
    229227                this->getAbsCoor ().z);
    230228  /* rotate */
    231   this->getAbsDir ().matrix (matrix);
    232   glMultMatrixf((float*)matrix);
    233 
     229  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     230  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    234231  this->model->draw();
    235232  glPopMatrix();
  • orxonox/trunk/src/world_entities/skybox.cc

    r4836 r4998  
    167167  this->size = size;
    168168}
    169 
    170 /**
    171  *  draws the SkyBox
    172 */
    173 void SkyBox::draw()
    174 {
    175   glPushMatrix();
    176   glMatrixMode(GL_MODELVIEW);
    177   Vector r = this->getAbsCoor();
    178   glTranslatef(r.x, r.y, r.z);
    179 
    180   this->model->draw();
    181 
    182   glPopMatrix();
    183 }
    184 
    185169
    186170/**
  • orxonox/trunk/src/world_entities/skybox.h

    r4836 r4998  
    3434
    3535  void setSize(float size);
    36   /** \brief assumes jpg as input-format */
     36  /** assumes jpg as input-format */
    3737  void setTexture(const char* name) { setTextureAndType (name, "jpg"); };
    3838
     
    4040  void setTextures(const char* top, const char* bottom, const char* left,
    4141                   const char* right, const char* front, const char* back);
    42 
    43   virtual void draw();
    4442
    4543 private:
  • orxonox/trunk/src/world_entities/terrain.cc

    r4924 r4998  
    106106  glMatrixMode(GL_MODELVIEW);
    107107  glPushMatrix();
    108   float matrix[4][4];
    109108
    110109  /* translate */
     
    113112                this->getAbsCoor ().z);
    114113  /* rotate */
    115   this->getAbsDir ().matrix (matrix);
    116   glMultMatrixf((float*)matrix);
     114  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     115  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    117116
    118117  if (this->objectList)
  • orxonox/trunk/src/world_entities/world_entity.cc

    r4885 r4998  
    179179  glMatrixMode(GL_MODELVIEW);
    180180  glPushMatrix();
    181   float matrix[4][4];
    182 
    183181  /* translate */
    184182  glTranslatef (this->getAbsCoor ().x,
     
    186184                this->getAbsCoor ().z);
    187185  /* rotate */
    188   this->getAbsDir ().matrix (matrix);
    189   glMultMatrixf((float*)matrix);
     186  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     187  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    190188
    191189  if (this->obbTree)
Note: See TracChangeset for help on using the changeset viewer.