Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h @ 10179

Last change on this file since 10179 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: 4.2 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_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
17#define BT_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
[1963]18
[2430]19#include "btActivatingCollisionAlgorithm.h"
[1963]20#include "BulletCollision/BroadphaseCollision/btDispatcher.h"
21#include "BulletCollision/BroadphaseCollision/btBroadphaseInterface.h"
22#include "BulletCollision/CollisionShapes/btTriangleCallback.h"
23#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
24class btDispatcher;
25#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
26#include "btCollisionCreateFunc.h"
27
28///For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), processTriangle is called.
29class btConvexTriangleCallback : public btTriangleCallback
30{
31        btCollisionObject* m_convexBody;
32        btCollisionObject* m_triBody;
33
34        btVector3       m_aabbMin;
35        btVector3       m_aabbMax ;
36
[2430]37
[1963]38        btManifoldResult* m_resultOut;
39        btDispatcher*   m_dispatcher;
40        const btDispatcherInfo* m_dispatchInfoPtr;
41        btScalar m_collisionMarginTriangle;
42       
43public:
44int     m_triangleCount;
45       
46        btPersistentManifold*   m_manifoldPtr;
47
48        btConvexTriangleCallback(btDispatcher* dispatcher,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
49
50        void    setTimeStepAndCounters(btScalar collisionMarginTriangle,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
51
52        virtual ~btConvexTriangleCallback();
53
54        virtual void processTriangle(btVector3* triangle, int partId, int triangleIndex);
55       
56        void clearCache();
57
58        SIMD_FORCE_INLINE const btVector3& getAabbMin() const
59        {
60                return m_aabbMin;
61        }
62        SIMD_FORCE_INLINE const btVector3& getAabbMax() const
63        {
64                return m_aabbMax;
65        }
66
67};
68
69
70
71
72/// btConvexConcaveCollisionAlgorithm  supports collision between convex shapes and (concave) trianges meshes.
[2430]73class btConvexConcaveCollisionAlgorithm  : public btActivatingCollisionAlgorithm
[1963]74{
75
76        bool    m_isSwapped;
77
78        btConvexTriangleCallback m_btConvexTriangleCallback;
79
80
[2430]81
[1963]82public:
83
84        btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci,btCollisionObject* body0,btCollisionObject* body1,bool isSwapped);
85
86        virtual ~btConvexConcaveCollisionAlgorithm();
87
88        virtual void processCollision (btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
89
90        btScalar        calculateTimeOfImpact(btCollisionObject* body0,btCollisionObject* body1,const btDispatcherInfo& dispatchInfo,btManifoldResult* resultOut);
91
92        virtual void    getAllContactManifolds(btManifoldArray& manifoldArray);
93       
94        void    clearCache();
95
96        struct CreateFunc :public       btCollisionAlgorithmCreateFunc
97        {
98                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
99                {
100                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConcaveCollisionAlgorithm));
101                        return new(mem) btConvexConcaveCollisionAlgorithm(ci,body0,body1,false);
102                }
103        };
104
105        struct SwappedCreateFunc :public        btCollisionAlgorithmCreateFunc
106        {
107                virtual btCollisionAlgorithm* CreateCollisionAlgorithm(btCollisionAlgorithmConstructionInfo& ci, btCollisionObject* body0,btCollisionObject* body1)
108                {
109                        void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(btConvexConcaveCollisionAlgorithm));
110                        return new(mem) btConvexConcaveCollisionAlgorithm(ci,body0,body1,true);
111                }
112        };
113
114};
115
[8393]116#endif //BT_CONVEX_CONCAVE_COLLISION_ALGORITHM_H
Note: See TracBrowser for help on using the repository browser.