Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Private Attributes
btManifoldResult Class Reference

btManifoldResult is a helper class to manage contact results. More...

#include <btManifoldResult.h>

Inheritance diagram for btManifoldResult:
Inheritance graph
[legend]
Collaboration diagram for btManifoldResult:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 btManifoldResult ()
 btManifoldResult (btCollisionObject *body0, btCollisionObject *body1)
virtual ~btManifoldResult ()
void setPersistentManifold (btPersistentManifold *manifoldPtr)
const btPersistentManifold * getPersistentManifold () const
btPersistentManifold * getPersistentManifold ()
virtual void setShapeIdentifiers (int partId0, int index0, int partId1, int index1)
 setShapeIdentifiers provides experimental support for per-triangle material / custom material combiner
virtual void addContactPoint (const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
SIMD_FORCE_INLINE void refreshContactPoints ()

Private Attributes

btPersistentManifold * m_manifoldPtr
btTransform m_rootTransA
btTransform m_rootTransB
btCollisionObject * m_body0
btCollisionObject * m_body1
int m_partId0
int m_partId1
int m_index0
int m_index1

Detailed Description

btManifoldResult is a helper class to manage contact results.

Definition at line 34 of file btManifoldResult.h.


Constructor & Destructor Documentation

Definition at line 50 of file btManifoldResult.h.

       {
       }
btManifoldResult::btManifoldResult ( btCollisionObject *  body0,
btCollisionObject *  body1 
)

Definition at line 46 of file btManifoldResult.cpp.

              :m_manifoldPtr(0),
              m_body0(body0),
              m_body1(body1)
{
       m_rootTransA = body0->getWorldTransform();
       m_rootTransB = body1->getWorldTransform();
}
virtual btManifoldResult::~btManifoldResult ( ) [inline, virtual]

Definition at line 56 of file btManifoldResult.h.

{};

Member Function Documentation

void btManifoldResult::addContactPoint ( const btVector3 normalOnBInWorld,
const btVector3 pointInWorld,
btScalar  depth 
) [virtual]

todo, check this for any side effects

Implements btDiscreteCollisionDetectorInterface::Result.

Definition at line 56 of file btManifoldResult.cpp.

{
       assert(m_manifoldPtr);
       //order in manifold needs to match
       
       if (depth > m_manifoldPtr->getContactBreakingThreshold())
              return;

       bool isSwapped = m_manifoldPtr->getBody0() != m_body0;

       btVector3 pointA = pointInWorld + normalOnBInWorld * depth;

       btVector3 localA;
       btVector3 localB;
       
       if (isSwapped)
       {
              localA = m_rootTransB.invXform(pointA );
              localB = m_rootTransA.invXform(pointInWorld);
       } else
       {
              localA = m_rootTransA.invXform(pointA );
              localB = m_rootTransB.invXform(pointInWorld);
       }

       btManifoldPoint newPt(localA,localB,normalOnBInWorld,depth);
       newPt.m_positionWorldOnA = pointA;
       newPt.m_positionWorldOnB = pointInWorld;
       
       int insertIndex = m_manifoldPtr->getCacheEntry(newPt);

       newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1);
       newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1);

   //BP mod, store contact triangles.
   newPt.m_partId0 = m_partId0;
   newPt.m_partId1 = m_partId1;
   newPt.m_index0  = m_index0;
   newPt.m_index1  = m_index1;
       
       if (insertIndex >= 0)
       {
              //const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);
              m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
       } else
       {
              m_manifoldPtr->AddManifoldPoint(newPt);
       }

       //User can override friction and/or restitution
       if (gContactAddedCallback &&
              //and if either of the two bodies requires custom material
               ((m_body0->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
                 (m_body1->getCollisionFlags() & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
       {
              //experimental feature info, for per-triangle material etc.
              btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
              btCollisionObject* obj1 = isSwapped? m_body0 : m_body1;
              (*gContactAddedCallback)(newPt,obj0,m_partId0,m_index0,obj1,m_partId1,m_index1);
       }

}

Here is the call graph for this function:

Here is the caller graph for this function:

const btPersistentManifold* btManifoldResult::getPersistentManifold ( ) const [inline]

Definition at line 63 of file btManifoldResult.h.

       {
              return m_manifoldPtr;
       }
btPersistentManifold* btManifoldResult::getPersistentManifold ( ) [inline]

Definition at line 67 of file btManifoldResult.h.

       {
              return m_manifoldPtr;
       }

Definition at line 82 of file btManifoldResult.h.

       {
              btAssert(m_manifoldPtr);
              if (!m_manifoldPtr->getNumContacts())
                     return;

              bool isSwapped = m_manifoldPtr->getBody0() != m_body0;

              if (isSwapped)
              {
                     m_manifoldPtr->refreshContactPoints(m_rootTransB,m_rootTransA);
              } else
              {
                     m_manifoldPtr->refreshContactPoints(m_rootTransA,m_rootTransB);
              }
       }

Here is the caller graph for this function:

void btManifoldResult::setPersistentManifold ( btPersistentManifold *  manifoldPtr) [inline]

Definition at line 58 of file btManifoldResult.h.

       {
              m_manifoldPtr = manifoldPtr;
       }

Here is the caller graph for this function:

virtual void btManifoldResult::setShapeIdentifiers ( int  partId0,
int  index0,
int  partId1,
int  index1 
) [inline, virtual]

setShapeIdentifiers provides experimental support for per-triangle material / custom material combiner

Implements btDiscreteCollisionDetectorInterface::Result.

Definition at line 72 of file btManifoldResult.h.

       {
                     m_partId0=partId0;
                     m_partId1=partId1;
                     m_index0=index0;
                     m_index1=index1;            
       }

Here is the caller graph for this function:


Member Data Documentation

btCollisionObject* btManifoldResult::m_body0 [private]

Definition at line 42 of file btManifoldResult.h.

btCollisionObject* btManifoldResult::m_body1 [private]

Definition at line 43 of file btManifoldResult.h.

Definition at line 46 of file btManifoldResult.h.

Definition at line 47 of file btManifoldResult.h.

btPersistentManifold* btManifoldResult::m_manifoldPtr [private]

Definition at line 36 of file btManifoldResult.h.

Definition at line 44 of file btManifoldResult.h.

Definition at line 45 of file btManifoldResult.h.

Definition at line 39 of file btManifoldResult.h.

Definition at line 40 of file btManifoldResult.h.


The documentation for this class was generated from the following files: