- Timestamp:
- May 28, 2006, 6:46:33 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r7919 r7927 249 249 /// Collision 250 250 CL_COLLISION = 0x00000711, 251 CL_COLLISION_HANDLE = 0x00000712, 251 252 CL_BV_TREE = 0x00701000, 252 253 CL_BV_TREE_NODE = 0x00702000, -
trunk/src/defs/include_paths.am
r7193 r7927 24 24 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/physics/fields 25 25 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/collision_detection 26 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/collision_reaction 26 27 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/newmat 27 28 AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/sound -
trunk/src/lib/collision_reaction/Makefile.am
r7819 r7927 4 4 noinst_LIBRARIES = libORXcr.a 5 5 6 libORXcr_a_SOURCES = cr_engine.cc 6 libORXcr_a_SOURCES = cr_engine.cc \ 7 collision_handle.cc 7 8 8 9 9 10 10 noinst_HEADERS = cr_engine.h 11 noinst_HEADERS = cr_engine.h \ 12 collision_handle.h 11 13 -
trunk/src/lib/collision_reaction/collision_handle.cc
r7841 r7927 10 10 11 11 ### File Specific: 12 main-programmer: Pat irick Boenzli12 main-programmer: Patrick Boenzli 13 13 */ 14 14 … … 24 24 * @todo this constructor is not jet implemented - do it 25 25 */ 26 CollisionHandle::CollisionHandle ( )26 CollisionHandle::CollisionHandle (WorldEntity* owner, CREngine::CRType type) 27 27 { 28 this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle"); 28 this->setClassID(CL_COLLISION_HANDLE, "CollisionHandle"); 29 30 this->owner = owner; 31 this->type = type; 29 32 30 33 } -
trunk/src/lib/collision_reaction/collision_handle.h
r7841 r7927 8 8 9 9 #include "base_object.h" 10 #include "cr_engine.h" 11 12 #include <vector> 13 10 14 11 15 class Collision; 16 class WorldEntity; 17 18 // struct CRType; 19 12 20 13 21 //! A class for defining collision reactions and storing events … … 15 23 16 24 public: 17 CollisionHandle( );25 CollisionHandle(WorldEntity* owner, CREngine::CRType type); 18 26 virtual ~CollisionHandle(); 27 28 29 void addTarget(); 19 30 20 31 void registerCollision(Collision* collision); … … 25 36 private: 26 37 WorldEntity* owner; //!< the worldenity this reaction will be applied on 27 classID targetClass; //!< the entities triggering the handle38 CREngine::CRType type; //!< the reaction type 28 39 29 40 bool bDispatched; //!< true if this handle has already been dispatched 30 bool bStopOnFirstCollision 41 bool bStopOnFirstCollision; //!< true if the cd of this object should be terminated after one match 31 42 32 43 std::vector<Collision*> collisionList; //!< a list full of collisions 33 std::vector< classID>targetList; //!< a list of target classes for filtering44 std::vector<long> targetList; //!< a list of target classes for filtering 34 45 35 46 }; -
trunk/src/lib/collision_reaction/cr_engine.cc
r7865 r7927 47 47 48 48 49 CollisionHandle* CREngine::subscribeReaction(WorldEntity* worldEntity, CRType type, int nrOfTargets, ...)49 CollisionHandle* CREngine::subscribeReaction(WorldEntity* owner, CRType type, int nrOfTargets, ...) 50 50 { 51 51 52 va_list itemlist; 52 53 va_start (itemlist, type); 53 for (int i = 0; i < nrOfTargets; i++)54 this->targetList.push_back(va_arg(itemlist, int));54 // for (int i = 0; i < nrOfTargets; i++) 55 // this->targetList.push_back(va_arg(itemlist, int)); 55 56 va_end(itemlist); 56 57 } -
trunk/src/lib/collision_reaction/cr_engine.h
r7865 r7927 20 20 { 21 21 22 public: 22 23 typedef enum CRType { 23 CR_CONSERVATION_OF_MOMENTUM = 0, 24 CR_PHYSICS_MOMENTUM = 0, 25 CR_PHYSICS_GROUND, 26 CR_PHYSICS_GROUND_WALK, 24 27 25 28 CR_OBJECT_DAMAGE, … … 28 31 CR_VERTEX_TRAFO, 29 32 30 CR_ CALLBACK,33 CR_SPECIAL_CALLBACK, 31 34 32 35 CR_NUMBER 33 36 }; 34 37 38 virtual ~CREngine(void); 35 39 36 public:37 virtual ~CREngine(void);38 40 /** @returns a Pointer to the only object of this Class */ 39 41 inline static CREngine* getInstance(void) { if (!singletonRef) singletonRef = new CREngine(); return singletonRef; }; … … 57 59 CREngine(void); 58 60 61 59 62 private: 60 63 std::vector<CollisionHandle*> collisionHandles; //!< list with the collision handles 61 64 std::vector<Collision*> cachedCollisions; //!< a list of unused, cached collision events 62 std::vector<int> targetList;63 65 64 66 static CREngine* singletonRef; //!< the reference to the CREngine object (singleton) -
trunk/src/world_entities/world_entity.cc
r7779 r7927 32 32 #include "camera.h" 33 33 34 #include "cr_engine.h" 35 #include "collision_handle.h" 36 37 34 38 using namespace std; 35 39 … … 65 69 66 70 this->toList(OM_NULL); 71 72 //this->collisionHandles = new *CollisionHandle[CREngine::CR_NUMBER](); 67 73 } 68 74 … … 228 234 } 229 235 236 237 /** 238 * subscribes this world entity to a collision reaction 239 * @param type the type of reaction to subscribe to 240 * @param nrOfTargets number of target filters 241 * @param ... the targets as classIDs 242 */ 243 void WorldEntity::subscribeReaction(CREngine::CRType type, int nrOfTargets, ...) 244 {} 245 246 230 247 /** 231 248 * @brief moves this entity to the List OM_List -
trunk/src/world_entities/world_entity.h
r7779 r7927 11 11 #include "model.h" 12 12 13 #include "cr_engine.h" 13 14 #include "object_manager.h" 14 15 #include "glincl.h" 15 16 #include <vector> 17 #include <stdarg.h> 18 19 16 20 17 21 // FORWARD DECLARATION … … 21 25 class BVTree; 22 26 class Model; 27 class CollisionHandle; 28 23 29 24 30 //class CharacterAttributes; … … 54 60 virtual void draw () const; 55 61 62 /* --- Collision Detection Block --- */ 56 63 bool buildObbTree(int depth); 57 64 virtual void collidesWith (WorldEntity* entity, const Vector& location); … … 60 67 void drawBVTree(int depth, int drawMode) const; 61 68 62 void debugWE() { this->debugEntity(); } 63 ; ///FIXME 64 void debugEntity() const; 69 /* --- Collision Reaction Block --- */ 70 void subscribeReaction(CREngine::CRType type, int nrOfTargets, ...); 65 71 66 72 … … 72 78 // CharacterAttributes* getCharacterAttributes(); 73 79 80 /* --- Object Manager Block --- */ 74 81 void toList(OM_LIST list); 75 76 77 82 /** @returns a Reference to the objectListNumber to set. */ 78 83 OM_LIST& getOMListNumber() { return this->objectListNumber; } … … 80 85 ObjectManager::EntityList::iterator& getEntityIterator() { return this->objectListIterator; } 81 86 87 /* --- Network Block --- */ 82 88 int writeState(const byte* data, int length, int sender); 83 89 int readState(byte* data, int maxLength ); 84 90 91 /* --- Character Attribute Block --- */ 85 92 /** @returns the Energy of the entity */ 86 93 float getHealth() const { return this->health; }; … … 92 99 OrxGui::GLGuiWidget* getHealthWidget(); 93 100 bool hasHealthWidget() const { return this->healthWidget; }; 101 102 /* --- Misc Stuff Block --- */ 103 void debugWE() { this->debugEntity(); } 104 ; ///FIXME 105 void debugEntity() const; 106 94 107 95 108 protected: … … 121 134 122 135 float scaling; 136 CollisionHandle** collisionHandles; 123 137 124 138
Note: See TracChangeset
for help on using the changeset viewer.