- Timestamp:
- Oct 20, 2006, 1:21:09 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_filter.cc
r9896 r9898 151 151 152 152 153 /** 154 * tests if the owner WorldEntity is listening to collisions from another specif WorldEntity entity 155 * @param entity WorldEntity to test against 156 * 157 * This is the most important interface function of this class: it performs a check and returns true 158 * if the WorldEntity entity is actualy responsive for a certain other WorldEntity 159 */ 160 bool CollisionFilter::operator()(const WorldEntity* entity, const CREngine::ReactionType type) const 161 { 162 // if there are no installed criterions just ommit and 163 if( this->bReactive()) 164 return false; 153 165 154 } 166 // goes through all registered filter criterions and looks for matches 167 std::vector<ClassID>::const_iterator it = this->_filters[type].begin(); 168 for(; it != this->_filters[type].end(); i++ ) 169 if( unlikely(entity->isA(*it))) 170 return true; 171 172 return false; 173 } 155 174 156 175 157 176 177 } // namespace end 178 179 180 -
branches/coll_rect/src/lib/collision_reaction/collision_filter.h
r9896 r9898 22 22 23 23 class CollisionReaction; 24 25 24 26 25 … … 49 48 /* Defines Operators */ 50 49 bool operator()(const WorldEntity* entity) const; 50 bool operator()(const WorldEntity* entity, const CREngine::ReactionType type) const; 51 51 52 52 53 53 /* Collision Reaction subscription unsubscription Block */ 54 54 public: 55 void subscribeReaction(C oRe::CREngine::ReactionType type, const ClassID& target1);56 void subscribeReaction(C oRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2);57 void subscribeReaction(C oRe::CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3);55 void subscribeReaction(CREngine::ReactionType type, const ClassID& target1); 56 void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2); 57 void subscribeReaction(CREngine::ReactionType type, const ClassID& target1, const ClassID& target2, const ClassID& target3); 58 58 59 void unsubscribeReaction(C oRe::CREngine::ReactionType type);59 void unsubscribeReaction(CREngine::ReactionType type); 60 60 void unsubscribeReactions(); 61 61 -
branches/coll_rect/src/lib/collision_reaction/collision_tube.cc
r9896 r9898 111 111 112 112 113 114 /** 115 * handles all collisions in registered in this tube 116 */ 117 void CollisionTube::handleCollisions() 118 { 119 // 120 } 121 122 113 123 /** 114 124 * checks if two objects are … … 124 134 125 135 126 /**127 * handles all collisions in registered in this tube128 */129 void CollisionTube::handleCollisions()130 {131 //132 }133 136 134 137 135 } 138 }// namespace end 136 139 -
branches/coll_rect/src/lib/collision_reaction/collision_tube.h
r9896 r9898 48 48 ObjectListDeclaration(CollisionTube); 49 49 50 51 /* Constructor/Deconstructor/Singleton Interface */ 50 52 public: 53 inline static CollisionTube* getInstance() { if( CollisionTube::instance != NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; } 51 54 virtual ~CollisionTube(); 52 55 53 inline static CollisionTube* getInstance() { if( CollisionTube::instance != NULL) CollisionTube::instance = new CollisionTube(); return CollisionTube::instance; } 56 private: 57 CollisionTube(); 58 CollisionTube(const CollisionTube& tube) {} 54 59 55 /** @returns true if at least one of both WorldEntities are subscribed for a collision check */ 56 inline bool isReactive(const WorldEntity& entityA, const WorldEntity& entityB) const 57 { return (entityA.isReactive() && entityB.isReactive()); } 58 bool needCollisionChecking(const WorldEntity& entityA, const WorldEntity& entityB); 60 static CollisionTube* instance; //!< the singleton instance 59 61 62 63 /* Collision Handling */ 64 public: 60 65 void registerCollisionEvent(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB); 61 66 void registerCollisionEvent(CREngine::CollisionType type, WorldEntity* entity, WorldEntity* groundEntity, … … 64 69 void handleCollisions(); 65 70 66 67 private:68 /* private std constructor since this is a singleton class */69 CollisionTube();70 /* private copy constructor so this object can't be passed as a */71 CollisionTube(const CollisionTube& tube) {}72 73 74 71 private: 75 72 std::vector<Collision*> _collisionList; //!< the list of collisions since the last processing 76 73 77 static CollisionTube* instance; //!< the singleton instance 74 75 /* Misc State Informations */ 76 public: 77 /** @returns true if at least one of both WorldEntities are subscribed for a collision check */ 78 inline bool isReactive(const WorldEntity& entityA, const WorldEntity& entityB) const 79 { return (entityA.isReactive() && entityB.isReactive()); } 80 bool needCollisionChecking(const WorldEntity& entityA, const WorldEntity& entityB); 81 78 82 }; 79 83
Note: See TracChangeset
for help on using the changeset viewer.