[21] | 1 | #ifndef _OGREODESPACE_H_ |
---|
| 2 | #define _OGREODESPACE_H_ |
---|
| 3 | |
---|
| 4 | #include "OgreOdePreReqs.h" |
---|
| 5 | #include "OgreOdeMaintainedList.h" |
---|
| 6 | |
---|
| 7 | namespace OgreOde |
---|
| 8 | { |
---|
| 9 | class _OgreOdeExport Space |
---|
| 10 | { |
---|
| 11 | friend class Geometry; |
---|
| 12 | friend class World; |
---|
| 13 | |
---|
| 14 | public: |
---|
| 15 | Space(World *world, const Space* space = 0); |
---|
| 16 | virtual ~Space(); |
---|
| 17 | |
---|
| 18 | void registerSpace(); |
---|
| 19 | |
---|
| 20 | void setAutoCleanup(bool on); |
---|
| 21 | bool getAutoCleanup(); |
---|
| 22 | |
---|
| 23 | void addGeometry(const Geometry& geometry); |
---|
| 24 | void removeGeometry(const Geometry& geometry); |
---|
| 25 | bool containsGeometry(const Geometry& geometry); |
---|
| 26 | int getGeometryCount(); |
---|
| 27 | Geometry* getGeometry(int index); |
---|
| 28 | |
---|
| 29 | virtual void collide(void* data = 0); |
---|
| 30 | virtual void collide(Space* space,void* data = 0); |
---|
| 31 | virtual void collide(Geometry* geometry,void* data = 0); |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | virtual void collide(CollisionCallback* colCallback); |
---|
| 35 | virtual void collide(CollisionCallback* colCallback, Space* space); |
---|
| 36 | virtual void collide(CollisionCallback* colCallback, Geometry* geometry); |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | void setInternalCollisions(bool collide); |
---|
| 40 | bool getInternalCollisions(); |
---|
| 41 | |
---|
| 42 | virtual const Ogre::AxisAlignedBox& getAxisAlignedBox(); |
---|
| 43 | |
---|
| 44 | virtual unsigned long getID(); |
---|
| 45 | |
---|
| 46 | World* getWorld(){ return _world; } |
---|
| 47 | |
---|
| 48 | protected: |
---|
| 49 | dSpaceID getSpaceID() const; |
---|
| 50 | dSpaceID getSpaceID(const Space* space) const; |
---|
| 51 | |
---|
| 52 | protected: |
---|
| 53 | dSpaceID _space; |
---|
| 54 | bool _internal_collisions; |
---|
| 55 | Ogre::AxisAlignedBox _bounding_box; |
---|
| 56 | World *_world; |
---|
| 57 | }; |
---|
| 58 | |
---|
| 59 | class _OgreOdeExport SimpleSpace:public Space |
---|
| 60 | { |
---|
| 61 | public: |
---|
| 62 | SimpleSpace(World *world, const Space* space = 0); |
---|
| 63 | ~SimpleSpace(); |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | class _OgreOdeExport HashTableSpace:public Space |
---|
| 67 | { |
---|
| 68 | public: |
---|
| 69 | HashTableSpace(World *world, const Space* space = 0); |
---|
| 70 | ~HashTableSpace(); |
---|
| 71 | |
---|
| 72 | void setLevels(int min_level,int max_level); |
---|
| 73 | int getMinimumLevel(); |
---|
| 74 | int getMaximumLevel(); |
---|
| 75 | }; |
---|
| 76 | |
---|
| 77 | class _OgreOdeExport QuadTreeSpace:public Space |
---|
| 78 | { |
---|
| 79 | public: |
---|
| 80 | QuadTreeSpace(const Ogre::Vector3& center,const Ogre::Vector3& extents,int depth,World *world, const Space* space = 0); |
---|
| 81 | ~QuadTreeSpace(); |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | /* |
---|
| 85 | * use Scene manager specialized scene partition algo to find collision |
---|
| 86 | * |
---|
| 87 | */ |
---|
| 88 | class _OgreOdeExport OgreSceneManagerSpace:public Space |
---|
| 89 | { |
---|
| 90 | public: |
---|
| 91 | OgreSceneManagerSpace(const Ogre::Vector3& center, |
---|
| 92 | const Ogre::Vector3& extents, |
---|
| 93 | int depth, |
---|
| 94 | Ogre::SceneManager *scn_mgr, |
---|
| 95 | World *world, const Space* space = 0); |
---|
| 96 | ~OgreSceneManagerSpace(); |
---|
| 97 | |
---|
| 98 | void collide(void* data = 0); |
---|
| 99 | |
---|
| 100 | private: |
---|
| 101 | Ogre::SceneManager *_scn_mgr; |
---|
| 102 | Ogre::IntersectionSceneQuery *_intersection_query; |
---|
| 103 | |
---|
| 104 | // does scene manager has plane collision geometry support |
---|
| 105 | // BSP scene manager has that. |
---|
| 106 | bool _scene_geometry; |
---|
| 107 | }; |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | #endif |
---|
| 111 | |
---|