Changeset 9983 in orxonox.OLD for branches/coll_rect
- Timestamp:
- Dec 2, 2006, 4:11:40 PM (18 years ago)
- Location:
- branches/coll_rect/src/lib/collision_reaction
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision.cc
r9980 r9983 43 43 void Collision::flushCollisionEvents() 44 44 { 45 this-> entityA = NULL;46 this-> entityB = NULL;45 this->_entityA = NULL; 46 this->_entityB = NULL; 47 47 48 this->entityACollide = false; 49 this->entityBCollide = false; 50 51 this->bDispatched = true; 48 this->_entityACollide = false; 49 this->_entityBCollide = false; 52 50 53 51 this->_collisionEvents.clear(); -
branches/coll_rect/src/lib/collision_reaction/collision.h
r9939 r9983 42 42 /* list stuff */ 43 43 public: 44 typedef std::vector<CollisionEvent*> collisionVector; //!< the vector containing all collision events45 typedef std::vector<CollisionEvent*>::iterator iterator; //!< iterator definition46 typedef std::vector<CollisionEvent*>::const_iterator const_iterator; //!< constant iterator definition44 typedef std::vector<CollisionEvent*> CollisionVector; //!< the vector containing all collision events 45 typedef std::vector<CollisionEvent*>::iterator Iterator; //!< iterator definition 46 typedef std::vector<CollisionEvent*>::const_iterator ConstIterator; //!< constant iterator definition 47 47 48 48 /** registers a @param event CollisionEvent to take place */ 49 49 inline void registerCollisionEvent(CollisionEvent* event) { this->_collisionEvents.push_back(event); this->bDispatched = false;} 50 /** @returns a vector of collision events */51 inline const std::vector<CollisionEvent*>& getCollisionEvents() const { return this->_collisionEvents; }52 50 53 51 void flushCollisionEvents(); … … 55 53 56 54 /** @returns iterator pointing to the beginning of the collision event vector */ 57 inline iterator begin() { return this->_collisionEvents.begin(); }55 inline Iterator begin() { return this->_collisionEvents.begin(); } 58 56 /** @returns const iterator pointing to the beginning of the collision event vector */ 59 inline const_iteratorbegin() const { return this->_collisionEvents.begin(); }57 inline ConstIterator begin() const { return this->_collisionEvents.begin(); } 60 58 /** @returns iterator pointing to the end of the collision event vector */ 61 inline iterator end() { return this->_collisionEvents.end(); }59 inline Iterator end() { return this->_collisionEvents.end(); } 62 60 /** @returns const iterator pointing to the end of the collision event vector */ 63 inline const_iterator end() const { return this->_collisionEvents.end(); } 64 65 66 private: 67 collisionVector _collisionEvents; //!< the collision event list 68 61 inline ConstIterator end() const { return this->_collisionEvents.end(); } 69 62 70 63 … … 72 65 public: 73 66 /** @return Collision WorldEntity A */ 74 inline WorldEntity* getEntityA() const { return this-> entityA; }67 inline WorldEntity* getEntityA() const { return this->_entityA; } 75 68 /** @return Collision WorldEntity B */ 76 inline WorldEntity* getEntityB() const { return this-> entityB; }69 inline WorldEntity* getEntityB() const { return this->_entityB; } 77 70 inline bool match(const WorldEntity& entityA, WorldEntity& entityB) const { 78 return ((this-> entityA == &entityA && this->entityB == &entityB) || (this->entityA == &entityB && this->entityB == &entityA)); }71 return ((this->_entityA == &entityA && this->_entityB == &entityB) || (this->_entityA == &entityB && this->_entityB == &entityA)); } 79 72 80 73 /** @return true if Entity A collides */ 81 inline bool isEntityACollide() const { return this-> entityACollide; }74 inline bool isEntityACollide() const { return this->_entityACollide; } 82 75 /** sets the flag if it reacts @param flag true if it should react on entityA*/ 83 inline void setEntityACollide(bool flag) { this-> entityACollide = flag; }76 inline void setEntityACollide(bool flag) { this->_entityACollide = flag; } 84 77 /** @return true if Entity B collides */ 85 inline bool isEntityBCollide() const { return this-> entityBCollide; }78 inline bool isEntityBCollide() const { return this->_entityBCollide; } 86 79 /** sets the flag if it reacts @param flag true if it should react on entityB*/ 87 inline void setEntityBCollide(bool flag) { this-> entityACollide = flag; }80 inline void setEntityBCollide(bool flag) { this->_entityACollide = flag; } 88 81 89 82 83 private: 84 WorldEntity* _entityA; //!< the collision body A 85 WorldEntity* _entityB; //!< the collision body B 86 bool _entityACollide; //!< true if entity A is subscribed for collision reaction 87 bool _entityBCollide; //!< true if entity B is subscribed for collision reaction 90 88 91 /** @returns true if this Collision has already been dispatched */ 92 inline bool isDispatched() { return this->bDispatched; } 93 /** sets the dispatched flag to true */ 94 inline void dispatched() { this->bDispatched = true; } 95 96 private: 97 WorldEntity* entityA; //!< the collision body A 98 WorldEntity* entityB; //!< the collision body B 99 bool entityACollide; //!< true if entity A is subscribed for collision reaction 100 bool entityBCollide; //!< true if entity B is subscribed for collision reaction 101 102 bool bDispatched; //!< true if this collision has already been dispatched 89 collisionVector _collisionEvents; //!< the collision event list 103 90 104 91 }; -
branches/coll_rect/src/lib/collision_reaction/collision_tube.cc
r9981 r9983 145 145 if( (*ci)->getEntityA()->bReactibe((*it)->getEnityB(), i) || (*ci)->getEntityB()->bReactibe((*it)->getEnityA(), i)) 146 146 (*ci)->reactToCollision(*ci); 147 148 (*ci)->flushCollisionEvents(); 147 149 } 148 150 } -
branches/coll_rect/src/lib/collision_reaction/collision_tube.h
r9981 r9983 70 70 void handleCollisions(); 71 71 72 72 73 private: 73 74 std::vector<Collision*> _collisionList; //!< the list of collisions since the last processing
Note: See TracChangeset
for help on using the changeset viewer.