Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/ogreode/OgreOdeSpace.h @ 1919

Last change on this file since 1919 was 1919, checked in by rgrieder, 16 years ago

Added OgreODE to our source repository because already we really need the newest version. And there is no hope to find any packages under linux.
The files included should compile and link with Ogre 1.4/1.6 and ODE 0.9/0.10. I was only able to test Ogre 1.4 and ODE 0.9/.10 under msvc until now.

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
1#ifndef _OGREODESPACE_H_
2#define _OGREODESPACE_H_
3
4#include "OgreOdePreReqs.h"
5#include "OgreOdeMaintainedList.h"
6
7namespace OgreOde
8{
9        class _OgreOdeExport Space
10        {
11        friend class Geometry;
12                friend class World;
13       
14#if ODE_VERSION_MINOR > 9
15        public:
16                enum Class
17                {
18                        Class_SimpleSpace               = dSimpleSpaceClass,
19                        Class_HashSpace                 = dHashSpaceClass,
20                        Class_SweepAndPrune             = dSweepAndPruneSpaceClass,
21                        Class_QuadTree                  = dQuadTreeSpaceClass,
22                        Class_FirstUser                 = dFirstUserClass,
23                        Class_LastUser                  = dLastUserClass
24                };
25                Space::Class getClass(); 
26#endif
27
28        public:
29                Space(World *world, const Space* space = 0);
30                virtual ~Space();
31
32                void registerSpace();
33
34                void setAutoCleanup(bool on); 
35                bool getAutoCleanup(); 
36
37                void addGeometry(const Geometry& geometry); 
38                void removeGeometry(const Geometry& geometry); 
39                bool containsGeometry(const Geometry& geometry); 
40                int getGeometryCount(); 
41                Geometry* getGeometry(int index);
42
43                virtual void collide(void* data = 0);
44                virtual void collide(Space* space,void* data = 0);
45                virtual void collide(Geometry* geometry,void* data = 0);
46               
47               
48                virtual void collide(CollisionCallback* colCallback, bool useInternalCollisionFlag = true);
49                virtual void collide(CollisionCallback* colCallback, Space* space);
50                virtual void collide(CollisionCallback* colCallback, Geometry* geometry, bool useInternalCollisionFlag = true);
51               
52               
53                void setInternalCollisions(bool collide);
54                bool getInternalCollisions();
55
56                virtual const Ogre::AxisAlignedBox& getAxisAlignedBox(); 
57
58                virtual size_t getID();
59
60                World* getWorld(){ return _world; }
61
62        protected:
63                dSpaceID getSpaceID() const;
64                dSpaceID getSpaceID(const Space* space) const;
65
66        protected:
67                dSpaceID                _space;
68                bool                    _internal_collisions;
69                Ogre::AxisAlignedBox    _bounding_box;
70        World                   *_world;
71        };
72
73        class _OgreOdeExport SimpleSpace:public Space
74        {
75        public:
76                SimpleSpace(World *world, const Space* space = 0);
77                ~SimpleSpace();
78        };
79
80        class _OgreOdeExport HashTableSpace:public Space
81        {
82        public:
83                HashTableSpace(World *world, const Space* space = 0);
84                ~HashTableSpace();
85
86                void setLevels(int min_level,int max_level);
87                int getMinimumLevel();
88                int getMaximumLevel();
89        };
90
91        class _OgreOdeExport QuadTreeSpace:public Space
92        {
93        public:
94                QuadTreeSpace(const Ogre::Vector3& center,const Ogre::Vector3& extents,int depth,World *world, const Space* space = 0);
95                ~QuadTreeSpace();
96    };
97
98#if ODE_VERSION_MINOR > 9
99        class _OgreOdeExport SweepAndPruneSpace : public Space
100        {
101        public:
102                enum AxisOrder
103                {
104                        AxisOrder_XYZ = dSAP_AXES_XYZ,
105                        AxisOrder_XZY = dSAP_AXES_XZY,
106                        AxisOrder_YXZ = dSAP_AXES_YXZ,
107                        AxisOrder_YZX = dSAP_AXES_YZX,
108                        AxisOrder_ZXY = dSAP_AXES_ZXY,
109                        AxisOrder_ZYX = dSAP_AXES_ZYX
110                };
111               
112                // "Order XZY or ZXY usually works best, if your Y is up."
113                SweepAndPruneSpace(AxisOrder axisOrder, World *world, const Space* space = 0);
114        };
115#endif
116       
117    /*
118    * use Scene manager specialized scene partition algo to find collision
119    *
120    */
121    class _OgreOdeExport OgreSceneManagerSpace:public Space
122    {
123    public:
124        OgreSceneManagerSpace(const Ogre::Vector3& center,
125                                const Ogre::Vector3& extents,
126                                int depth,
127                                Ogre::SceneManager *scn_mgr,
128                                World *world, const Space* space = 0);
129        ~OgreSceneManagerSpace();
130
131        void collide(void* data = 0);
132
133    private:
134        Ogre::SceneManager              *_scn_mgr;
135        Ogre::IntersectionSceneQuery    *_intersection_query;
136
137        // does scene manager has plane collision geometry support
138        // BSP scene manager has that.
139        bool                            _scene_geometry;
140    };
141
142       
143}
144
145#endif
146
Note: See TracBrowser for help on using the repository browser.