Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ggz2/src/external/bullet/BulletCollision/CollisionDispatch/btManifoldResult.h @ 7669

Last change on this file since 7669 was 5738, checked in by landauf, 15 years ago

merged libraries2 back to trunk

  • Property svn:eol-style set to native
File size: 2.9 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
17#ifndef MANIFOLD_RESULT_H
18#define MANIFOLD_RESULT_H
19
20class btCollisionObject;
21#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
22class btManifoldPoint;
23
24#include "BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h"
25
26#include "LinearMath/btTransform.h"
27
28typedef bool (*ContactAddedCallback)(btManifoldPoint& cp,       const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1);
29extern ContactAddedCallback             gContactAddedCallback;
30
31
32
33///btManifoldResult is a helper class to manage  contact results.
34class btManifoldResult : public btDiscreteCollisionDetectorInterface::Result
35{
36        btPersistentManifold* m_manifoldPtr;
37
38        //we need this for compounds
39        btTransform     m_rootTransA;
40        btTransform     m_rootTransB;
41
42        btCollisionObject* m_body0;
43        btCollisionObject* m_body1;
44        int     m_partId0;
45        int m_partId1;
46        int m_index0;
47        int m_index1;
48       
49
50public:
51
52        btManifoldResult()
53        {
54        }
55
56        btManifoldResult(btCollisionObject* body0,btCollisionObject* body1);
57
58        virtual ~btManifoldResult() {};
59
60        void    setPersistentManifold(btPersistentManifold* manifoldPtr)
61        {
62                m_manifoldPtr = manifoldPtr;
63        }
64
65        const btPersistentManifold*     getPersistentManifold() const
66        {
67                return m_manifoldPtr;
68        }
69        btPersistentManifold*   getPersistentManifold()
70        {
71                return m_manifoldPtr;
72        }
73
74        virtual void setShapeIdentifiers(int partId0,int index0,        int partId1,int index1)
75        {
76                        m_partId0=partId0;
77                        m_partId1=partId1;
78                        m_index0=index0;
79                        m_index1=index1;               
80        }
81
82
83        virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth);
84
85        SIMD_FORCE_INLINE       void refreshContactPoints()
86        {
87                btAssert(m_manifoldPtr);
88                if (!m_manifoldPtr->getNumContacts())
89                        return;
90
91                bool isSwapped = m_manifoldPtr->getBody0() != m_body0;
92
93                if (isSwapped)
94                {
95                        m_manifoldPtr->refreshContactPoints(m_rootTransB,m_rootTransA);
96                } else
97                {
98                        m_manifoldPtr->refreshContactPoints(m_rootTransA,m_rootTransB);
99                }
100        }
101
102
103};
104
105#endif //MANIFOLD_RESULT_H
Note: See TracBrowser for help on using the repository browser.