Changeset 3644 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Mar 23, 2005, 2:32:06 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/null_parent.cc
r3608 r3644 77 77 worry, normaly... 78 78 */ 79 void NullParent::update ( )79 void NullParent::update (float dt) 80 80 { 81 81 … … 92 92 if( this->bRelDirChanged || this->bAbsDirChanged) 93 93 pn->parentDirChanged (); 94 pn->update ( );94 pn->update (dt); 95 95 pn = this->children->nextElement (); 96 96 } -
orxonox/trunk/src/lib/coord/null_parent.h
r3607 r3644 19 19 20 20 21 virtual void update ( );22 21 virtual void update (float dt); 22 23 23 private: 24 24 NullParent (); -
orxonox/trunk/src/lib/coord/p_node.cc
r3617 r3644 115 115 this->absDirection = new Quaternion(); 116 116 this->relDirection = new Quaternion(); 117 this->lastAbsCoordinate = new Vector(); 117 118 } 118 119 … … 297 298 {} 298 299 300 301 /** 302 \brief this calculates the current movement speed of the node 303 */ 304 float PNode::getSpeed() 305 { 306 if(this->time == 0) 307 return 0; 308 Vector* diff = new Vector(); 309 *diff = *this->absCoordinate - *this->lastAbsCoordinate; 310 float x = diff->len(); 311 return x / this->time; 312 } 313 314 299 315 /** 300 316 \brief adds a child and makes this node to a parent … … 422 438 worry, normaly... 423 439 */ 424 void PNode::update () 425 { 440 void PNode::update (float dt) 441 { 442 this->time = dt; 426 443 PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z); 427 444 // printf("%s", this->objectName); … … 486 503 pn->parentDirChanged (); 487 504 488 pn->update( );505 pn->update(dt); 489 506 pn = this->children->nextElement(); 490 507 } -
orxonox/trunk/src/lib/coord/p_node.h
r3608 r3644 72 72 void shiftDir (Quaternion* shift); 73 73 74 float getSpeed(); 75 74 76 void addChild (PNode* pNode); 75 77 void addChild (PNode* pNode, int parentingMode); … … 84 86 int getMode(); 85 87 86 virtual void update ( );88 virtual void update (float dt); 87 89 void processTick (float dt); 88 90 … … 92 94 93 95 void debug (); 94 95 private:96 void init(PNode* parent);97 96 98 97 protected: … … 111 110 int mode; //!< the mode of the binding 112 111 112 private: 113 void init(PNode* parent); 114 115 Vector* lastAbsCoordinate; //!< this is used for speedcalculation, it stores the last coordinate 116 float time; //!< time since last update 113 117 }; 114 118 -
orxonox/trunk/src/story_entities/world.cc
r3643 r3644 128 128 World::World (int worldID) 129 129 { 130 printf(">>>>>>>>>>>>>>>>>WORLD::WORLD called NEW WORLD created\n");131 130 this->init(NULL, worldID); 132 131 } … … 604 603 p4->debug (); 605 604 606 p1->update ( );605 p1->update (0); 607 606 608 607 printf ("World::debug() - update\n"); … … 613 612 614 613 p2->shiftCoor (new Vector(-1, -1, -1)); 615 p1->update ( );614 p1->update (0); 616 615 617 616 p1->debug (); … … 623 622 624 623 625 p1->update ( );624 p1->update (0); 626 625 627 626 p1->debug (); … … 720 719 if(!this->bPause) 721 720 { 722 Uint32dt = currentFrame - this->lastFrame;721 this->dt = currentFrame - this->lastFrame; 723 722 724 723 if(dt > 0) … … 765 764 void World::update() 766 765 { 767 this->nullParent->update ( );766 this->nullParent->update (dt); 768 767 } 769 768 -
orxonox/trunk/src/story_entities/world.h
r3634 r3644 87 87 88 88 Uint32 lastFrame; //!< last time of frame 89 Uint32 dt; //!< time needed to calculate this frame 89 90 bool bQuitOrxonox; //!< quit this application 90 91 bool bQuitCurrentGame; //!< quit only the current game and return to menu
Note: See TracChangeset
for help on using the changeset viewer.