Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @ 10256

Last change on this file since 10256 was 8351, checked in by rgrieder, 14 years ago

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
  • Property svn:eol-style set to native
File size: 6.1 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16///btDbvtBroadphase implementation by Nathanael Presson
17#ifndef BT_DBVT_BROADPHASE_H
18#define BT_DBVT_BROADPHASE_H
19
20#include "BulletCollision/BroadphaseCollision/btDbvt.h"
21#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
22
23//
24// Compile time config
25//
26
27#define DBVT_BP_PROFILE                                 0
28//#define DBVT_BP_SORTPAIRS                             1
29#define DBVT_BP_PREVENTFALSEUPDATE              0
30#define DBVT_BP_ACCURATESLEEPING                0
31#define DBVT_BP_ENABLE_BENCHMARK                0
32#define DBVT_BP_MARGIN                                  (btScalar)0.05
33
34#if DBVT_BP_PROFILE
35#define DBVT_BP_PROFILING_RATE  256
36#include "LinearMath/btQuickprof.h"
37#endif
38
39//
40// btDbvtProxy
41//
42struct btDbvtProxy : btBroadphaseProxy
43{
44        /* Fields               */ 
45        //btDbvtAabbMm  aabb;
46        btDbvtNode*             leaf;
47        btDbvtProxy*    links[2];
48        int                             stage;
49        /* ctor                 */ 
50        btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) :
51        btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask)
52        {
53                links[0]=links[1]=0;
54        }
55};
56
57typedef btAlignedObjectArray<btDbvtProxy*>      btDbvtProxyArray;
58
59///The btDbvtBroadphase implements a broadphase using two dynamic AABB bounding volume hierarchies/trees (see btDbvt).
60///One tree is used for static/non-moving objects, and another tree is used for dynamic objects. Objects can move from one tree to the other.
61///This is a very fast broadphase, especially for very dynamic worlds where many objects are moving. Its insert/add and remove of objects is generally faster than the sweep and prune broadphases btAxisSweep3 and bt32BitAxisSweep3.
62struct  btDbvtBroadphase : btBroadphaseInterface
63{
64        /* Config               */ 
65        enum    {
66                DYNAMIC_SET                     =       0,      /* Dynamic set index    */ 
67                FIXED_SET                       =       1,      /* Fixed set index              */ 
68                STAGECOUNT                      =       2       /* Number of stages             */ 
69        };
70        /* Fields               */ 
71        btDbvt                                  m_sets[2];                                      // Dbvt sets
72        btDbvtProxy*                    m_stageRoots[STAGECOUNT+1];     // Stages list
73        btOverlappingPairCache* m_paircache;                            // Pair cache
74        btScalar                                m_prediction;                           // Velocity prediction
75        int                                             m_stageCurrent;                         // Current stage
76        int                                             m_fupdates;                                     // % of fixed updates per frame
77        int                                             m_dupdates;                                     // % of dynamic updates per frame
78        int                                             m_cupdates;                                     // % of cleanup updates per frame
79        int                                             m_newpairs;                                     // Number of pairs created
80        int                                             m_fixedleft;                            // Fixed optimization left
81        unsigned                                m_updates_call;                         // Number of updates call
82        unsigned                                m_updates_done;                         // Number of updates done
83        btScalar                                m_updates_ratio;                        // m_updates_done/m_updates_call
84        int                                             m_pid;                                          // Parse id
85        int                                             m_cid;                                          // Cleanup index
86        int                                             m_gid;                                          // Gen id
87        bool                                    m_releasepaircache;                     // Release pair cache on delete
88        bool                                    m_deferedcollide;                       // Defere dynamic/static collision to collide call
89        bool                                    m_needcleanup;                          // Need to run cleanup?
90#if DBVT_BP_PROFILE
91        btClock                                 m_clock;
92        struct  {
93                unsigned long           m_total;
94                unsigned long           m_ddcollide;
95                unsigned long           m_fdcollide;
96                unsigned long           m_cleanup;
97                unsigned long           m_jobcount;
98        }                               m_profiling;
99#endif
100        /* Methods              */ 
101        btDbvtBroadphase(btOverlappingPairCache* paircache=0);
102        ~btDbvtBroadphase();
103        void                                                    collide(btDispatcher* dispatcher);
104        void                                                    optimize();
105       
106        /* btBroadphaseInterface Implementation */
107        btBroadphaseProxy*                              createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy);
108        virtual void                                    destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher);
109        virtual void                                    setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher);
110        virtual void                                    rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0));
111        virtual void                                    aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback);
112
113        virtual void                                    getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const;
114        virtual void                                    calculateOverlappingPairs(btDispatcher* dispatcher);
115        virtual btOverlappingPairCache* getOverlappingPairCache();
116        virtual const btOverlappingPairCache*   getOverlappingPairCache() const;
117        virtual void                                    getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const;
118        virtual void                                    printStats();
119
120
121        ///reset broadphase internal structures, to ensure determinism/reproducability
122        virtual void resetPool(btDispatcher* dispatcher);
123
124        void    performDeferredRemoval(btDispatcher* dispatcher);
125       
126        void    setVelocityPrediction(btScalar prediction)
127        {
128                m_prediction = prediction;
129        }
130        btScalar getVelocityPrediction() const
131        {
132                return m_prediction;
133        }
134
135        ///this setAabbForceUpdate is similar to setAabb but always forces the aabb update.
136        ///it is not part of the btBroadphaseInterface but specific to btDbvtBroadphase.
137        ///it bypasses certain optimizations that prevent aabb updates (when the aabb shrinks), see
138        ///http://code.google.com/p/bullet/issues/detail?id=223
139        void                                                    setAabbForceUpdate(             btBroadphaseProxy* absproxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* /*dispatcher*/);
140
141        static void                                             benchmark(btBroadphaseInterface*);
142
143
144};
145
146#endif
Note: See TracBrowser for help on using the repository browser.