Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h @ 2500

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

Merged physics_merge back to presentation branch.

  • Property svn:eol-style set to native
File size: 3.3 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;
29
30/// btCompoundCollisionAlgorithm  supports collision between CompoundCollisionShapes and other collision shapes
31class btCompoundCollisionAlgorithm  : public btActivatingCollisionAlgorithm
32{
33        btAlignedObjectArray<btCollisionAlgorithm*> m_childCollisionAlgorithms;
34        bool m_isSwapped;
35
36        class btPersistentManifold*     m_sharedManifold;
37        bool                                    m_ownsManifold;
38       
39public:
40
41        btCompoundCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
42
43        virtual ~btCompoundCollisionAlgorithm();
44
45        virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
46
47        btScalar        calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
48
49        virtual void    getAllContactManifolds(btManifoldArray& manifoldArray)
50        {
51                int i;
52                for (i=0;i<m_childCollisionAlgorithms.size();i++)
53                {
54                        if (m_childCollisionAlgorithms[i])
55                                m_childCollisionAlgorithms[i]->getAllContactManifolds(manifoldArray);
56                }
57        }
58
59        struct CreateFunc :public       btCollisionAlgorithmCreateFunc
60        {
61                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
62                {
63                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
64                        return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,false);
65                }
66        };
67
68        struct SwappedCreateFunc :public        btCollisionAlgorithmCreateFunc
69        {
70                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
71                {
72                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btCompoundCollisionAlgorithm));
73                        return new(mem) btCompoundCollisionAlgorithm(ci,body0,body1,true);
74                }
75        };
76
77};
78
79#endif //COMPOUND_COLLISION_ALGORITHM_H
Note: See TracBrowser for help on using the repository browser.