Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4145 in orxonox.OLD


Ignore:
Timestamp:
May 10, 2005, 4:54:00 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: every world-entity saves the speed of its own

Location:
orxonox/trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.in

    r4131 r4145  
    9292        tinyxmlparser.$(OBJEXT) benchmark.$(OBJEXT)
    9393orxonox_OBJECTS = $(am_orxonox_OBJECTS)
     94am__DEPENDENCIES_1 =
    9495DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
    9596depcomp = $(SHELL) $(top_srcdir)/depcomp
     
    275276noinst_LIBRARIES = libORXgui.a
    276277orxonox_DEPENDENCIES = libORXgui.a
    277 orxonox_LDADD = libORXgui.a
     278orxonox_LDADD = libORXgui.a $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    278279orxonox_SOURCES = orxonox.cc \
    279280                 game_loader.cc \
     
    408409
    409410libORXgui_a_CPPFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
    410 AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    411411libORXgui_a_SOURCES = lib/gui/gui/gui.cc \
    412412                            lib/gui/gui/gui_gtk.cc \
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3966 r4145  
    9999  this->parent = parent;
    100100  this->objectName = NULL;
    101   this->time = 1.0; /* set time to 1 to make divisions by zero impossible */
    102101}
    103102
     
    281280}
    282281
    283 
    284 
    285 /**
    286    \brief this calculates the current movement speed of the node
    287 */
    288 float PNode::getSpeed() const
    289 {
    290   return (this->absCoordinate - this->lastAbsCoordinate).len() / this->time;
    291 }
    292 
    293 /**
    294    \returns the Velocity of the PNode
    295 */
    296 Vector PNode::getVelocity() const
    297 {
    298   return (this->absCoordinate - this->lastAbsCoordinate) / this->time;
    299 }
    300 
    301282/**
    302283   \brief adds a child and makes this node to a parent
     
    424405{
    425406  this->lastAbsCoordinate = this->absCoordinate;
    426   this->time = dt;
     407
    427408  PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z);
    428409
     
    499480  delete iterator;
    500481
     482  this->velocity = (this->absCoordinate - this->lastAbsCoordinate) / dt;
    501483  this->timeStamp = timeStamp;
    502484  this->bRelCoorChanged = false;
  • orxonox/trunk/src/lib/coord/p_node.h

    r3966 r4145  
    6969  void shiftDir (const Quaternion& shift);
    7070
    71   float getSpeed() const;
    72   Vector getVelocity() const;
     71  /** \returns the Speed of the Node */
     72  inline float getSpeed() const {return this->velocity.len()/1000;} //! \FIX THIS SHOULD NOT BE /1000
     73  /** \returns the Velocity of the Node */
     74  inline const Vector& getVelocity() const {return this->velocity;}
    7375
    7476  void addChild (PNode* pNode, int parentingMode = DEFAULT_MODE);
     
    110112  void init(PNode* parent);
    111113
     114  Vector velocity;          //!< Saves the velocity.
    112115  Vector lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate
    113   Vector diffCoordinate;    //!< this is stored here for performance reasons, difference to the last vector
    114   float time;                //!< time since last update
    115116};
    116117
  • orxonox/trunk/src/story_entities/world.cc

    r4136 r4145  
    11121112     
    11131113      /* function to let all entities tick (iterate through list) */
    1114       float seconds = this->dt / 1000.0;     
    1115       this->gameTime += seconds;
     1114      this->dtS = (float)this->dt / 1000.0;     
     1115      this->gameTime += this->dtS;
    11161116      //entity = entities->enumerate();
    11171117      tIterator<WorldEntity>* iterator = this->entities->getIterator();
     
    11191119      while( entity != NULL)
    11201120        {
    1121           entity->tick (seconds);
     1121          entity->tick (this->dtS);
    11221122          entity = iterator->nextElement();
    11231123        }
     
    11271127      this->trackManager->tick(this->dt);
    11281128      this->localCamera->tick(this->dt);
    1129       this->garbageCollector->tick(seconds);
    1130 
    1131       AnimationPlayer::getInstance()->tick(seconds);
     1129      this->garbageCollector->tick(this->dtS);
     1130
     1131      AnimationPlayer::getInstance()->tick(this->dtS);
    11321132    }
    11331133  this->lastFrame = currentFrame;
     
    11441144{
    11451145  this->garbageCollector->update();
    1146   this->nullParent->update (dt);
     1146  this->nullParent->update (this->dtS);
    11471147}
    11481148
  • orxonox/trunk/src/story_entities/world.h

    r4015 r4145  
    9494  Uint32 lastFrame;                   //!< last time of frame
    9595  Uint32 dt;                          //!< time needed to calculate this frame
     96  float dtS;                          //!< The time needed for caluculations in seconds
    9697  double gameTime;                    //!< this is where the game time is saved
    9798  bool bQuitOrxonox;                  //!< quit this application
Note: See TracChangeset for help on using the changeset viewer.