Changeset 9895 in orxonox.OLD for branches/coll_rect/src/lib
- Timestamp:
- Oct 19, 2006, 3:54:49 PM (18 years ago)
- Location:
- branches/coll_rect/src/lib/collision_reaction
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/collision_filter.cc
r9894 r9895 15 15 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION_REACTION 16 16 17 #include "collision_ handle.h"17 #include "collision_filter.h" 18 18 19 19 #include "world_entity.h" … … 32 32 { 33 33 34 ObjectListDefinition(Collision Handle);34 ObjectListDefinition(CollisionFilter); 35 35 36 36 /** … … 38 38 * @todo this constructor is not jet implemented - do it 39 39 */ 40 Collision Handle::CollisionHandle(WorldEntity* owner, CREngine::ReactionType type)41 { 42 this->registerObject(this, Collision Handle::_objectList);40 CollisionFilter::CollisionFilter (WorldEntity* owner, CREngine::ReactionType type) 41 { 42 this->registerObject(this, CollisionFilter::_objectList); 43 43 44 44 this->owner = owner; … … 76 76 * standard deconstructor 77 77 */ 78 Collision Handle::~CollisionHandle()78 CollisionFilter::~CollisionFilter () 79 79 { 80 80 // delete what has to be deleted here … … 84 84 85 85 /** 86 * restores the Collision Handleto its initial state87 */ 88 void Collision Handle::reset()86 * restores the CollisionFilter to its initial state 87 */ 88 void CollisionFilter::reset() 89 89 { 90 90 this->flushCollisions(); … … 96 96 * @param classID the classid to look for 97 97 */ 98 void Collision Handle::addTarget(const ClassID& target)98 void CollisionFilter::addTarget(const ClassID& target) 99 99 { 100 100 // make sure there is no dublicate … … 114 114 * handles the collisions and react according to algorithm 115 115 */ 116 void Collision Handle::handleCollisions()116 void CollisionFilter::handleCollisions() 117 117 { 118 118 // if continuous poll the reaction … … 146 146 * @param collisionEvent the collision event to filter 147 147 */ 148 bool Collision Handle::filterCollisionEvent(CollisionEvent* collisionEvent)148 bool CollisionFilter::filterCollisionEvent(CollisionEvent* collisionEvent) 149 149 { 150 150 std::vector<ClassID>::iterator it = this->targetList.begin(); … … 201 201 * @param collision the collision object to filter 202 202 */ 203 bool Collision Handle::filterCollision(Collision* collision)203 bool CollisionFilter::filterCollision(Collision* collision) 204 204 { 205 205 std::vector<ClassID>::iterator it = this->targetList.begin(); -
branches/coll_rect/src/lib/collision_reaction/collision_filter.h
r9894 r9895 4 4 */ 5 5 6 #ifndef _COLLISION_ HANDLE_H7 #define _COLLISION_ HANDLE_H6 #ifndef _COLLISION_FILTER_H 7 #define _COLLISION_FILTER_H 8 8 9 9 #include "base_object.h" … … 25 25 26 26 //! A class for defining collision reactions and storing events 27 class Collision Handle: public BaseObject27 class CollisionFilter : public BaseObject 28 28 { 29 ObjectListDeclaration(Collision Handle);29 ObjectListDeclaration(CollisionFilter); 30 30 31 31 public: 32 Collision Handle(WorldEntity* owner, CREngine::ReactionType type);33 virtual ~Collision Handle();32 CollisionFilter(WorldEntity* owner, CREngine::ReactionType type); 33 virtual ~CollisionFilter(); 34 34 35 35 void reset(); … … 73 73 74 74 } 75 #endif /* _COLLISION_ HANDLE_H */75 #endif /* _COLLISION_FILTER_H */ -
branches/coll_rect/src/lib/collision_reaction/cr_engine.cc
r9893 r9895 20 20 #include "collision.h" 21 21 #include "collision_event.h" 22 #include "collision_ handle.h"22 #include "collision_filter.h" 23 23 #include "cr_defs.h" 24 24 … … 122 122 void CREngine::reset() 123 123 { 124 // first clear all CollisionHandles125 std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin();126 for(; it < this->collisionHandles.end(); it++)127 {128 (*it)->reset();129 delete *it;130 }131 132 this->collisionHandles.clear();124 // // first clear all CollisionHandles 125 // std::vector<CollisionHandle*>::iterator it = this->collisionHandles.begin(); 126 // for(; it < this->collisionHandles.end(); it++) 127 // { 128 // (*it)->reset(); 129 // delete *it; 130 // } 131 // 132 // this->collisionHandles.clear(); 133 133 } 134 134 … … 140 140 * @return the newly created CollisionHandle 141 141 */ 142 CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, ReactionType type)143 {144 CollisionHandle* ch = new CollisionHandle(owner, type);145 this->collisionHandles.push_back(ch);146 147 return ch;148 }142 // CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, ReactionType type) 143 // { 144 // CollisionHandle* ch = new CollisionHandle(owner, type); 145 // this->collisionHandles.push_back(ch); 146 // 147 // return ch; 148 // } 149 149 150 150 … … 154 154 * @param returns true if worked collrectly 155 155 */ 156 bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle)157 {158 std::vector<CollisionHandle*>::iterator it;159 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)160 {161 if( *it == collisionHandle)162 {163 this->collisionHandles.erase(it);164 delete collisionHandle;165 return true;166 }167 }168 return false;169 }156 // bool CREngine::unsubscribeReaction(CollisionHandle* collisionHandle) 157 // { 158 // std::vector<CollisionHandle*>::iterator it; 159 // for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 160 // { 161 // if( *it == collisionHandle) 162 // { 163 // this->collisionHandles.erase(it); 164 // delete collisionHandle; 165 // return true; 166 // } 167 // } 168 // return false; 169 // } 170 170 171 171 … … 175 175 void CREngine::handleCollisions() 176 176 { 177 std::vector<CollisionHandle*>::iterator it;178 for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++)179 {180 if( !(*it)->isDispatched() || (*it)->isContinuousPoll()) //does it have any collisions to report at all181 {182 (*it)->handleCollisions();183 }184 }185 this->flushCollisions();177 // std::vector<CollisionHandle*>::iterator it; 178 // for( it = this->collisionHandles.begin(); it != this->collisionHandles.end(); it++) 179 // { 180 // if( !(*it)->isDispatched() || (*it)->isContinuousPoll()) //does it have any collisions to report at all 181 // { 182 // (*it)->handleCollisions(); 183 // } 184 // } 185 // this->flushCollisions(); 186 186 } 187 187 -
branches/coll_rect/src/lib/collision_reaction/cr_engine.h
r9892 r9895 21 21 namespace CoRe 22 22 { 23 class CollisionHandle;24 23 class Collision; 25 24 class CollisionEvent; … … 61 60 62 61 63 #define COLLISION_TYPE_AXIS_X 164 #define COLLISION_TYPE_AXIS_X_NEG 265 //!< the collision axis y collision event66 #define COLLISION_TYPE_AXIS_Y 367 #define COLLISION_TYPE_AXIS_Y_NEG 468 //!< the collision axis z collision event69 #define COLLISION_TYPE_AXIS_Z 570 #define COLLISION_TYPE_AXIS_Z_NEG 671 //!< the collision is a obb collision72 #define COLLISION_TYPE_OBB 873 74 62 virtual ~CREngine(void); 75 63 … … 77 65 inline static CREngine* getInstance() { if (!singletonRef) singletonRef = new CREngine(); return singletonRef; }; 78 66 79 CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ReactionType type);80 bool unsubscribeReaction(CollisionHandle* collisionHandle);67 // CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ReactionType type); 68 // bool unsubscribeReaction(CollisionHandle* collisionHandle); 81 69 82 70 … … 98 86 99 87 private: 100 std::vector<CollisionHandle*> collisionHandles; //!< list with the collision handles88 //std::vector<CollisionHandle*> collisionHandles; //!< list with the collision handles 101 89 102 90 std::vector<Collision*> collisionsUsed; //!< a list of used, cached collisions -
branches/coll_rect/src/lib/collision_reaction/cr_physics_full_walk.cc
r9892 r9895 96 96 { 97 97 /* collision in the X-AXIS */ 98 caseCOLLISION_TYPE_AXIS_X:98 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X: 99 99 front = collPos.len() - box->halfLength[0]; 100 100 … … 116 116 break; 117 117 118 caseCOLLISION_TYPE_AXIS_X_NEG:118 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_X_NEG: 119 119 back = collPos.len() - box->halfLength[0]; 120 120 … … 138 138 139 139 /* collision in the Y-AXIS */ 140 caseCOLLISION_TYPE_AXIS_Y_NEG:140 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG: 141 141 // calulate the height above ground 142 142 height = collPos.len() - box->halfLength[1]; … … 165 165 166 166 /* collision in the Z-AXIS */ 167 caseCOLLISION_TYPE_AXIS_Z:167 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z: 168 168 169 169 right = collPos.len() - box->halfLength[2]; … … 187 187 188 188 // collision in the z-axis 189 caseCOLLISION_TYPE_AXIS_Z_NEG:189 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Z_NEG: 190 190 191 191 left = collPos.len() - box->halfLength[2]; -
branches/coll_rect/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9889 r9895 94 94 { 95 95 /* collision in the Y-AXIS */ 96 caseCOLLISION_TYPE_AXIS_Y_NEG:96 case CoRe::CREngine::CR_COLLISION_TYPE_AXIS_Y_NEG: 97 97 // calulate the height above ground 98 98 height = collPos.len() - box->halfLength[1];
Note: See TracChangeset
for help on using the changeset viewer.