Back to index

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

For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), processTriangle is called. More...

#include <btConvexConcaveCollisionAlgorithm.h>

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

List of all members.

Public Member Functions

 btConvexTriangleCallback (btDispatcher *dispatcher, btCollisionObject *body0, btCollisionObject *body1, bool isSwapped)
void setTimeStepAndCounters (btScalar collisionMarginTriangle, const btDispatcherInfo &dispatchInfo, btManifoldResult *resultOut)
virtual ~btConvexTriangleCallback ()
virtual void processTriangle (btVector3 *triangle, int partId, int triangleIndex)
void clearCache ()
SIMD_FORCE_INLINE const btVector3getAabbMin () const
SIMD_FORCE_INLINE const btVector3getAabbMax () const

Public Attributes

int m_triangleCount
btPersistentManifold * m_manifoldPtr

Private Attributes

btCollisionObject * m_convexBody
btCollisionObject * m_triBody
btVector3 m_aabbMin
btVector3 m_aabbMax
btManifoldResultm_resultOut
btDispatcherm_dispatcher
const btDispatcherInfom_dispatchInfoPtr
btScalar m_collisionMarginTriangle

Detailed Description

For each triangle in the concave mesh that overlaps with the AABB of a convex (m_convexProxy), processTriangle is called.

Definition at line 29 of file btConvexConcaveCollisionAlgorithm.h.


Constructor & Destructor Documentation

btConvexTriangleCallback::btConvexTriangleCallback ( btDispatcher dispatcher,
btCollisionObject *  body0,
btCollisionObject *  body1,
bool  isSwapped 
)

Definition at line 42 of file btConvexConcaveCollisionAlgorithm.cpp.

                                                                                                                                            :
         m_dispatcher(dispatcher),
       m_dispatchInfoPtr(0)
{
       m_convexBody = isSwapped? body1:body0;
       m_triBody = isSwapped? body0:body1;
       
         //
         // create the manifold from the dispatcher 'manifold pool'
         //
         m_manifoldPtr = m_dispatcher->getNewManifold(m_convexBody,m_triBody);

         clearCache();
}

Here is the call graph for this function:

Definition at line 57 of file btConvexConcaveCollisionAlgorithm.cpp.

Here is the call graph for this function:


Member Function Documentation

Definition at line 65 of file btConvexConcaveCollisionAlgorithm.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 62 of file btConvexConcaveCollisionAlgorithm.h.

       {
              return m_aabbMax;
       }

Here is the caller graph for this function:

Definition at line 58 of file btConvexConcaveCollisionAlgorithm.h.

       {
              return m_aabbMin;
       }

Here is the caller graph for this function:

void btConvexTriangleCallback::processTriangle ( btVector3 triangle,
int  partId,
int  triangleIndex 
) [virtual]

debug drawing of the overlapping triangles

this should use the btDispatcher, so the actual registered algorithm is used

Implements btTriangleCallback.

Definition at line 72 of file btConvexConcaveCollisionAlgorithm.cpp.

{
 
       //just for debugging purposes
       //printf("triangle %d",m_triangleCount++);


       //aabb filter is already applied!  

       btCollisionAlgorithmConstructionInfo ci;
       ci.m_dispatcher1 = m_dispatcher;

       btCollisionObject* ob = static_cast<btCollisionObject*>(m_triBody);


       
       if (m_dispatchInfoPtr && m_dispatchInfoPtr->m_debugDraw && m_dispatchInfoPtr->m_debugDraw->getDebugMode() > 0)
       {
              btVector3 color(255,255,0);
              btTransform& tr = ob->getWorldTransform();
              m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(triangle[1]),color);
              m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(triangle[2]),color);
              m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(triangle[0]),color);

              //btVector3 center = triangle[0] + triangle[1]+triangle[2];
              //center *= btScalar(0.333333);
              //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[0]),tr(center),color);
              //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[1]),tr(center),color);
              //m_dispatchInfoPtr->m_debugDraw->drawLine(tr(triangle[2]),tr(center),color);

       }


       //btCollisionObject* colObj = static_cast<btCollisionObject*>(m_convexProxy->m_clientObject);
       
       if (m_convexBody->getCollisionShape()->isConvex())
       {
              btTriangleShape tm(triangle[0],triangle[1],triangle[2]);       
              tm.setMargin(m_collisionMarginTriangle);
              btCollisionShape* tmpShape = ob->getCollisionShape();

              //copy over user pointers to temporary shape
              tm.setUserPointer(tmpShape->getUserPointer());
              
              ob->setCollisionShape( &tm );
              

              btCollisionAlgorithm* colAlgo = ci.m_dispatcher1->findAlgorithm(m_convexBody,m_triBody,m_manifoldPtr);
              //            btConvexConvexAlgorithm cvxcvxalgo(m_manifoldPtr,ci,m_convexBody,m_triBody);

              m_resultOut->setShapeIdentifiers(-1,-1,partId,triangleIndex);
       //     cvxcvxalgo.setShapeIdentifiers(-1,-1,partId,triangleIndex);
//            cvxcvxalgo.processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
              colAlgo->processCollision(m_convexBody,m_triBody,*m_dispatchInfoPtr,m_resultOut);
              colAlgo->~btCollisionAlgorithm();
              ci.m_dispatcher1->freeCollisionAlgorithm(colAlgo);
              ob->setCollisionShape( tmpShape );

       }

       

}

Here is the call graph for this function:

void btConvexTriangleCallback::setTimeStepAndCounters ( btScalar  collisionMarginTriangle,
const btDispatcherInfo dispatchInfo,
btManifoldResult resultOut 
)

Definition at line 140 of file btConvexConcaveCollisionAlgorithm.cpp.

{
       m_dispatchInfoPtr = &dispatchInfo;
       m_collisionMarginTriangle = collisionMarginTriangle;
       m_resultOut = resultOut;

       //recalc aabbs
       btTransform convexInTriangleSpace;
       convexInTriangleSpace = m_triBody->getWorldTransform().inverse() * m_convexBody->getWorldTransform();
       btCollisionShape* convexShape = static_cast<btCollisionShape*>(m_convexBody->getCollisionShape());
       //CollisionShape* triangleShape = static_cast<btCollisionShape*>(triBody->m_collisionShape);
       convexShape->getAabb(convexInTriangleSpace,m_aabbMin,m_aabbMax);
       btScalar extraMargin = collisionMarginTriangle;
       btVector3 extra(extraMargin,extraMargin,extraMargin);

       m_aabbMax += extra;
       m_aabbMin -= extra;
       
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 35 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 34 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 41 of file btConvexConcaveCollisionAlgorithm.h.

btCollisionObject* btConvexTriangleCallback::m_convexBody [private]

Definition at line 31 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 39 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 40 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 46 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 37 of file btConvexConcaveCollisionAlgorithm.h.

Definition at line 44 of file btConvexConcaveCollisionAlgorithm.h.

btCollisionObject* btConvexTriangleCallback::m_triBody [private]

Definition at line 32 of file btConvexConcaveCollisionAlgorithm.h.


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