Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/portals/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h @ 8176

Last change on this file since 8176 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 3.6 KB
Line 
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
16#ifndef COMPOUND_COLLISION_ALGORITHM_H
17#define COMPOUND_COLLISION_ALGORITHM_H
18
19#include "btActivatingCollisionAlgorithm.h"
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;
29class btCollisionObject;
30
31/// btCompoundCollisionAlgorithm  supports collision between CompoundCollisionShapes and other collision shapes
32class btCompoundCollisionAlgorithm  : public btActivatingCollisionAlgorithm
33{
34        btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
35        bool m_isSwapped;
36
37        class btPersistentManifold*     m_sharedManifold;
38        bool                                    m_ownsManifold;
39
40        int     m_compoundShapeRevision;//to keep track of changes, so that childAlgorithm array can be updated
41       
42        void    removeChildAlgorithms();
43       
44        void    preallocateChildAlgorithms(btCollisionObject* body0,btCollisionObject* body1);
45
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
86#endif //COMPOUND_COLLISION_ALGORITHM_H
Note: See TracBrowser for help on using the repository browser.