Changeset 9892 in orxonox.OLD for branches/coll_rect/src/lib/collision_reaction/cr_engine.h
- Timestamp:
- Oct 14, 2006, 1:25:47 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/coll_rect/src/lib/collision_reaction/cr_engine.h
r9889 r9892 31 31 32 32 public: 33 typedef enum CRType {34 CR_PHYSICS_MOMENTUM = 0, //!< physical reaction: conservervation of momentum35 CR_PHYSICS_STEP_BACK, //!< physical reaction: just go to the last position without collisions36 CR_PHYSICS_GROUND_WALK, //!< physical reaction: stand on the ground, no movement: simulatingsimple normal force away from the gravity force37 CR_PHYSICS_FULL_WALK, //!< physical reaction: walking on the ground (inkl. hills etc)38 CR_PHYSICS_DAMAGE, //!< physical reaction: daling damage according to the object energy and their structural stability33 typedef enum ReactionType { 34 CR_PHYSICS_MOMENTUM = 0, //!< physical reaction: conservervation of momentum 35 CR_PHYSICS_STEP_BACK, //!< physical reaction: just go to the last position without collisions 36 CR_PHYSICS_GROUND_WALK, //!< physical reaction: stand on the ground, no movement: simple normal force away from the gravity force 37 CR_PHYSICS_FULL_WALK, //!< physical reaction: walking on the ground (inkl. hills etc) 38 CR_PHYSICS_DAMAGE, //!< physical reaction: daling damage according to the object energy and their structural stability 39 39 40 CR_OBJECT_DAMAGE, //!< object raction: deals damage according to the objects specific damage potential (like weapons, nukes, etc.)41 CR_OBJECT_PICKUP, //!< object rection: calling the objects pickup functions, let them handle the collision (once!)40 CR_OBJECT_DAMAGE, //!< object raction: deals damage according to the objects specific damage potential (like weapons, nukes, etc.) 41 CR_OBJECT_PICKUP, //!< object rection: calling the objects pickup functions, let them handle the collision (once!) 42 42 43 CR_VERTEX_TRAFO, //!< vertex trafo: transforming the vertex according to the damage43 CR_VERTEX_TRAFO, //!< vertex trafo: transforming the vertex according to the damage 44 44 45 CR_SPECIAL_CALLBACK, //!< special: call a callback function45 CR_SPECIAL_CALLBACK, //!< special: call a callback function 46 46 47 47 CR_NUMBER 48 48 }; 49 50 typedef enum CollisionType { 51 CR_COLLISION_TYPE_AXIS_X = 0, //!< collision on x axis 52 CR_COLLISION_TYPE_AXIS_X_NEG, //!< collision on negative x axis 53 CR_COLLISION_TYPE_AXIS_Y, //!< collision on y axis 54 CR_COLLISION_TYPE_AXIS_Y_NEG, //!< collision on negative y axis 55 CR_COLLISION_TYPE_AXIS_Z, //!< collision on z axis 56 CR_COLLISION_TYPE_AXIS_Z_NEG, //!< collision on negative z axis 57 CR_COLLISION_TYPE_OBB, //!< object aligned bounding box collide 58 59 CR_COLLISION_TYPE_NUMBER 60 }; 61 62 63 #define COLLISION_TYPE_AXIS_X 1 64 #define COLLISION_TYPE_AXIS_X_NEG 2 65 //!< the collision axis y collision event 66 #define COLLISION_TYPE_AXIS_Y 3 67 #define COLLISION_TYPE_AXIS_Y_NEG 4 68 //!< the collision axis z collision event 69 #define COLLISION_TYPE_AXIS_Z 5 70 #define COLLISION_TYPE_AXIS_Z_NEG 6 71 //!< the collision is a obb collision 72 #define COLLISION_TYPE_OBB 8 49 73 50 74 virtual ~CREngine(void); … … 53 77 inline static CREngine* getInstance() { if (!singletonRef) singletonRef = new CREngine(); return singletonRef; }; 54 78 79 CollisionHandle* subscribeReaction(WorldEntity* worldEntity, ReactionType type); 80 bool unsubscribeReaction(CollisionHandle* collisionHandle); 81 82 83 Collision* popCollisionObject(); 84 CollisionEvent* popCollisionEventObject(); 55 85 void reset(); 56 86 57 58 CollisionHandle* subscribeReaction(WorldEntity* worldEntity, CRType type);59 60 bool unsubscribeReaction(CollisionHandle* collisionHandle);61 62 87 void handleCollisions(); 63 64 /** @returns an instance to a collision object. instead of creating new object this ones can be resycled */65 inline Collision* popCollisionObject()66 {67 if( !this->collisionsUnused.empty())68 {69 this->collisionsUsed.push_back(this->collisionsUnused.back()); this->collisionsUnused.pop_back(); return this->collisionsUsed.back();70 }71 else return NULL;72 }73 74 75 /** @return an instanco of a CollisionEvent object. instead of creating a new object this ones can be used and resycled */76 inline CollisionEvent* popCollisionEventObject()77 {78 if( !this->collisionEventsUnused.empty())79 {80 this->collisionEventsUsed.push_back(this->collisionEventsUnused.back()); this->collisionEventsUnused.pop_back(); return this->collisionEventsUsed.back();81 }82 else return NULL;83 }84 88 85 89 void debug();
Note: See TracChangeset
for help on using the changeset viewer.