Changeset 3860 in orxonox.OLD for orxonox/trunk/src
- Timestamp:
- Apr 17, 2005, 6:20:02 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/animation.cc
r3858 r3860 29 29 this->bHasKeys = false; 30 30 this->bHandled = true; 31 this->bDelete = false; 31 32 this->baseObject = NULL; 32 33 … … 84 85 break; 85 86 case ANIM_INF_DELETE: // this will possibly never be made 86 //this->bDelete;87 this->bDelete = true; 87 88 break; 88 89 } -
orxonox/trunk/src/animation.h
r3858 r3860 11 11 12 12 // FORWARD DEFINITION 13 14 #define DELTA_X 0.05 //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta15 13 16 14 //! An enumerator of Functions to describe the flow of the Animation … … 47 45 * Animation Functions 48 46 * virtual tick 47 * addKeyFrame 49 48 * List of keyFrames 50 49 * currentKeyFrame/nextKeyFrame … … 73 72 BaseObject* getBaseObject(void) const {return baseObject;} 74 73 74 /** \returns if the Animation should be deleted */ 75 inline bool ifDelete(void) {return bDelete;} 76 75 77 protected: 76 78 Animation(void); … … 85 87 bool bHandled; //!< If this Animation is handled by the AnimationPlayer. 86 88 bool bRunning; //!< If the animation is running 87 //bool bDelete; //!< If true, the animation will be deleted through the AnimationPlayer.89 bool bDelete; //!< If true, the animation will be deleted through the AnimationPlayer. 88 90 }; 89 91 -
orxonox/trunk/src/animation_player.cc
r3847 r3860 17 17 18 18 #include "animation_player.h" 19 20 #include "compiler.h" 19 21 20 22 using namespace std; … … 120 122 { 121 123 anim->tick(timePassed); 124 if(unlikely(anim->ifDelete())) 125 { 126 this->animationList->remove(anim); 127 delete anim; 128 } 122 129 anim = animIt->nextElement(); 123 130 } -
orxonox/trunk/src/defs/stdincl.h
r3810 r3860 29 29 #include "debug.h" 30 30 31 32 /* performance tweaking stuff */ 33 #ifdef __unix__ 34 #include <linux/compiler.h> 35 #define __LIKELY_IF(condition) if( likely(condition)) 36 #define __UNLIKELY_IF(condition) if( unlikely(condition)) 37 #else 38 #define __LIKELY_IF(condition) if( condition) 39 #define __UNLIKELY_IF(condition) if( condition) 40 #endif 31 #include "compiler.h" 41 32 42 33 #endif /* _STDINCL_H */ -
orxonox/trunk/src/lib/coord/p_node.cc
r3832 r3860 22 22 #include "p_node.h" 23 23 #include "stdincl.h" 24 #include "compiler.h" 24 25 25 26 #include "error.h" … … 61 62 *this->absCoordinate = absCoordinate; 62 63 63 __LIKELY_IF(parent != NULL)64 if (likely(parent != NULL)) 64 65 { 65 66 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); … … 208 209 { 209 210 210 __UNLIKELY_IF( this->bAbsCoorChanged)211 if( unlikely(this->bAbsCoorChanged)) 211 212 { 212 213 *this->absCoordinate = *this->absCoordinate + shift; … … 316 317 void PNode::addChild (PNode* pNode, int parentingMode) 317 318 { 318 __LIKELY_IF( pNode->parent != NULL)319 if( likely(pNode->parent != NULL)) 319 320 { 320 321 PRINTF(3)("PNode::addChild() - reparenting node: removing it and adding it again\n"); … … 436 437 437 438 438 __LIKELY_IF( this->mode & PNODE_MOVEMENT)439 if( likely(this->mode & PNODE_MOVEMENT)) 439 440 { 440 __UNLIKELY_IF(this->bAbsCoorChanged/*&& this->timeStamp != DataTank::timeStamp*/)441 if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 441 442 { 442 443 /* if you have set the absolute coordinates this overrides all other changes */ 443 444 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 444 445 } 445 __LIKELY_IF(this->bRelCoorChanged/*&& this->timeStamp != DataTank::timeStamp*/)446 if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 446 447 447 448 { … … 449 450 450 451 /* 451 __UNLIKELY_IF( this->parent == NULL)452 if( unlikely(this->parent == NULL)) 452 453 { 453 454 *this->absCoordinate = *this->relCoordinate; … … 460 461 if( this->mode & PNODE_LOCAL_ROTATE) 461 462 { 462 __UNLIKELY_IF( this->bAbsDirChanged/*&& this->timeStamp != DataTank::timeStamp*/)463 if( unlikely(this->bAbsDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 463 464 { 464 465 /* if you have set the absolute coordinates this overrides all other changes */ 465 466 *this->relDirection = *this->absDirection - parent->getAbsDir(); 466 467 } 467 else __LIKELY_IF( this->bRelDirChanged/*&& this->timeStamp != DataTank::timeStamp*/)468 else if( likely(this->bRelDirChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 468 469 { 469 470 /* update the current absDirection - remember * means rotation around sth.*/ … … 474 475 if( this->mode & PNODE_ROTATE_MOVEMENT) 475 476 { 476 __UNLIKELY_IF( this->bAbsCoorChanged/*&& this->timeStamp != DataTank::timeStamp*/)477 if( unlikely(this->bAbsCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 477 478 { 478 479 /* if you have set the absolute coordinates this overrides all other changes */ 479 480 *this->relCoordinate = *this->absCoordinate - parent->getAbsCoor (); 480 481 } 481 else __LIKELY_IF( this->bRelCoorChanged/*&& this->timeStamp != DataTank::timeStamp*/)482 else if( likely(this->bRelCoorChanged) /*&& this->timeStamp != DataTank::timeStamp*/) 482 483 { 483 484 /*this is bad style... must be deleted later - just for testing*/ … … 496 497 { 497 498 /* if this node has changed, make sure, that all children are updated also */ 498 __LIKELY_IF( this->bRelCoorChanged || this->bAbsCoorChanged)499 if( likely(this->bRelCoorChanged || this->bAbsCoorChanged)) 499 500 pn->parentCoorChanged (); 500 __LIKELY_IF( this->bRelDirChanged || this->bAbsDirChanged)501 if( likely(this->bRelDirChanged || this->bAbsDirChanged)) 501 502 pn->parentDirChanged (); 502 503 -
orxonox/trunk/src/lib/math/vector.cc
r3824 r3860 1 2 3 1 /* 4 2 orxonox - the future of 3D-vertical-scrollers … … 66 64 Vector Vector::operator/ (float f) const 67 65 { 68 __UNLIKELY_IF( f == 0.0)66 if( unlikely(f == 0.0)) 69 67 { 70 68 // Prevent divide by zero … … 105 103 { 106 104 float l = len(); 107 __UNLIKELY_IF(l != 1.0)105 if(unlikely(l != 1.0)) 108 106 { 109 107 return this; 110 108 } 111 else __UNLIKELY_IF(l == 0.0)109 else if(unlikely(l == 0.0)) 112 110 { 113 111 return 0; -
orxonox/trunk/src/lib/math/vector.h
r3823 r3860 10 10 11 11 #include <math.h> 12 #include " stdincl.h"12 #include "compiler.h" 13 13 //! PI the circle-constant 14 14 #define PI 3.14159265359f … … 41 41 inline void normalize() { 42 42 float l = len(); 43 __UNLIKELY_IF( l == 0.0)43 if( unlikely(l == 0.0)) 44 44 { 45 45 // Prevent divide by zero -
orxonox/trunk/src/lib/util/list.h
r3832 r3860 3 3 #define _LIST_H 4 4 5 #include "stdincl.h" 5 #include "compiler.h" 6 #ifndef NULL 7 #define NULL 0 8 #endif 6 9 7 10 //! An enum to list all the modes available when adding an object to a List … … 38 41 listElement* next; 39 42 }; 40 Uint32size;43 unsigned int size; 41 44 listElement* first; 42 45 listElement* last; … … 118 121 119 122 private: 120 Uint32size;123 unsigned int size; 121 124 listElement<T>* first; 122 125 listElement<T>* last; … … 153 156 inline void tList<T>::add(T* entity) 154 157 { 155 __UNLIKELY_IF( entity == NULL) return;158 if( unlikely(entity == NULL)) return; 156 159 listElement<T>* el = new listElement<T>; 157 160 el->prev = this->last; … … 161 164 this->last = el; 162 165 163 __UNLIKELY_IF(el->prev == NULL) this->first = el; /* if first element */166 if( unlikely(el->prev == NULL)) this->first = el; /* if first element */ 164 167 else el->prev->next = el; 165 168 this->size++; … … 174 177 while( this->currentEl != NULL) 175 178 { 176 __UNLIKELY_IF( this->currentEl->curr == entity)179 if( unlikely(this->currentEl->curr == entity)) 177 180 { 178 __UNLIKELY_IF( this->currentEl->prev == NULL) this->first = this->currentEl->next;181 if( unlikely(this->currentEl->prev == NULL)) this->first = this->currentEl->next; 179 182 else this->currentEl->prev->next = this->currentEl->next; 180 183 181 __UNLIKELY_IF( this->currentEl->next == NULL) this->last = this->currentEl->prev;184 if( unlikely(this->currentEl->next == NULL)) this->last = this->currentEl->prev; 182 185 else this->currentEl->next->prev = this->currentEl->prev; 183 186 -
orxonox/trunk/src/t_animation.h
r3859 r3860 22 22 23 23 #include "animation.h" 24 25 #define DELTA_X 0.05 //!< the percentag of the distance that doesnt have to be done by neg_exp (asymptotical) ~ maschinendelta 24 26 25 27 //! A Class to handle some animation for single floated values.
Note: See TracChangeset
for help on using the changeset viewer.