Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h @ 9891

Last change on this file since 9891 was 8393, checked in by rgrieder, 14 years ago

Updated Bullet from v2.77 to v2.78.
(I'm not going to make a branch for that since the update from 2.74 to 2.77 hasn't been tested that much either).

You will HAVE to do a complete RECOMPILE! I tested with MSVC and MinGW and they both threw linker errors at me.

  • Property svn:eol-style set to native
File size: 3.6 KB
RevLine 
[1963]1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
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
[8393]16#ifndef BT_COMPOUND_COLLISION_ALGORITHM_H
17#define BT_COMPOUND_COLLISION_ALGORITHM_H
[1963]18
[2430]19#include "btActivatingCollisionAlgorithm.h"
[1963]20#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
21#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
22
23#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
24class btDispatcher;
25#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
26#include "btCollisionCreateFunc.h"
27#include "LinearMath/btAlignedObjectArray.h"
28class btDispatcher;
[2882]29class btCollisionObject;
[1963]30
31/// btCompoundCollisionAlgorithm  supports collision between CompoundCollisionShapes and other collision shapes
[2430]32class btCompoundCollisionAlgorithm  : public btActivatingCollisionAlgorithm
[1963]33{
34        btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
35        bool m_isSwapped;
36
37        class btPersistentManifold*     m_sharedManifold;
38        bool                                    m_ownsManifold;
[2882]39
40        int     m_compoundShapeRevision;//to keep track of changes, so that childAlgorithm array can be updated
[1963]41       
[2882]42        void    removeChildAlgorithms();
43       
44        void    preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1);
45
[1963]46public:
47
48        btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
49
50        virtual ~btCompoundCollisionAlgorithm();
51
52        virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
53
54        btScalar        calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
55
56        virtual void    getAllContactManifolds(btManifoldArray& manifoldArray)
57        {
58                int i;
59                for (i=0;i<m_childCollisionAlgorithms.size();i++)
60                {
61                        if (m_childCollisionAlgorithms[i])
62                                m_childCollisionAlgorithms[i]->getAllContactManifolds(manifoldArray);
63                }
64        }
65
66        struct CreateFunc :public       btCollisionAlgorithmCreateFunc
67        {
68                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
69                {
70                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
71                        return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,false);
72                }
73        };
74
75        struct SwappedCreateFunc :public        btCollisionAlgorithmCreateFunc
76        {
77                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
78                {
79                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
80                        return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,true);
81                }
82        };
83
84};
85
[8393]86#endif //BT_COMPOUND_COLLISION_ALGORITHM_H
Note: See TracBrowser for help on using the repository browser.