Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3651 in orxonox.OLD


Ignore:
Timestamp:
Mar 24, 2005, 11:25:09 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: now got the trick with inline functions. they have to be placed at the same place as the header files are. modified BaseObject to be more performant, now isFinalized needs only 0.5 cycles! :) next stop, vector class

Location:
orxonox/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/lang/base_object.cc

    r3646 r3651  
    6060}
    6161
    62 
     62/*
    6363bool BaseObject::isFinalized()
    6464{
    65   return this->finalized;
     65 
    6666}
    67 
     67*/
    6868
    6969void BaseObject::finalize()
  • orxonox/trunk/src/lib/lang/base_object.h

    r3646 r3651  
    2121  bool isA (char* className);
    2222
    23   bool isFinalized();
     23  inline bool isFinalized() { return this->finalized; }
    2424  void finalize();
    2525
  • orxonox/trunk/src/orxonox.cc

    r3650 r3651  
    334334#include "vector.h"
    335335#include "player.h"
     336#include "base_object.h"
    336337#include "primitive.h"
    337338#include <asm/msr.h>
     
    469470
    470471     
     472      mittel = 0;
     473      BaseObject* bo = new BaseObject();
     474      for(i = 0; i < ITERATIONS; ++i)
     475        {
     476          rdtscl(ini);
     477         
     478          bo->isFinalized();
     479           
     480          rdtscl(end);
     481          mittel += (end - ini - dt);
     482          }
     483      //delete w;
     484      mi = mittel / (float)ITERATIONS;
     485      printf(" Inl funct BaseObject::isFinazlized(): \t%11.2f\n", mi);
     486
     487     
    471488      tList<WorldEntity>* list = new tList<WorldEntity>();
    472489
     
    545562          float mi;
    546563          int i = 0;
     564          // quaternion generieren mit spez konstruktor
     565          mittel = 0;
     566          Vector* qa = new Vector(4.6, 9.3, 0.4);
     567          Vector* qb = new Vector(3.5, 6.1, 4.3);
     568          for(i = 0; i < VECTOR_MAX; ++i)
     569            {
     570              rdtscl(ini);
     571             
     572              Quaternion* qu = new Quaternion(*qa, *qb);
     573             
     574              rdtscl(end);
     575              delete qu;
     576              mittel += (end - ini - dt);
     577            }
     578          delete a;
     579          delete b;
     580          mi = mittel / (float)VECTOR_MAX;
     581          printf(" Gen. quatern. betw. two vectors:\t%11.2f\n", mi);
     582
     583
    547584          // multiplication
    548585          mittel = 0;
     
    557594            }
    558595          mi = mittel / (float)VECTOR_MAX;
    559           printf(" Multiplying two quat. (=rot):\t\t%11.2f\n", mi);
    560 
    561 
    562           // multiplication
     596          printf(" Multiplying two quat.(=rot): a * b\t%11.2f\n", mi);
     597         
     598
     599
     600          // rotating a vector by a quaternion
    563601          mittel = 0;
    564602          for(i = 0; i < VECTOR_MAX; ++i)
     
    566604              rdtscl(ini);
    567605             
    568               *c = *a * *b;
     606              *qa = a->apply(*qb);
    569607             
    570608              rdtscl(end);
     
    572610            }
    573611          mi = mittel / (float)VECTOR_MAX;
    574           printf(" Multiplying two quat.(=rot):\t\t%11.2f\n", mi);
    575          
    576          
     612          printf(" Rot a vec by a quat: q->apply(v)\t%11.2f\n", mi);
     613         
     614         
     615
     616          // generate rotation matrix
     617          mittel = 0;
     618          float matrix[4][4];
     619          for(i = 0; i < VECTOR_MAX; ++i)
     620            {
     621              rdtscl(ini);
     622             
     623              a->matrix(matrix);
     624             
     625              rdtscl(end);
     626              mittel += (end - ini - dt);
     627            }
     628          mi = mittel / (float)VECTOR_MAX;
     629          printf(" Generate rot matrix: q->matrix(m)\t%11.2f\n", mi);
     630         
     631         
     632
     633         
     634
    577635        }
    578636     
Note: See TracChangeset for help on using the changeset viewer.