Skip to content

Commit

Permalink
3rdparty: bullet3: remove getters/setters from btCollisionObject
Browse files Browse the repository at this point in the history
  • Loading branch information
dbartolini committed Jan 31, 2025
1 parent f9ca4da commit fc97500
Show file tree
Hide file tree
Showing 73 changed files with 854 additions and 1,104 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ btBox2dBox2dCollisionAlgorithm::btBox2dBox2dCollisionAlgorithm(btPersistentManif
m_ownManifold(false),
m_manifoldPtr(mf)
{
if (!m_manifoldPtr && m_dispatcher->needsCollision(obj0Wrap->getCollisionObject(), obj1Wrap->getCollisionObject()))
if (!m_manifoldPtr && m_dispatcher->needsCollision(obj0Wrap->m_collisionObject, obj1Wrap->m_collisionObject))
{
m_manifoldPtr = m_dispatcher->getNewManifold(obj0Wrap->getCollisionObject(), obj1Wrap->getCollisionObject());
m_manifoldPtr = m_dispatcher->getNewManifold(obj0Wrap->m_collisionObject, obj1Wrap->m_collisionObject);
m_ownManifold = true;
}
}
Expand All @@ -55,12 +55,12 @@ void btBox2dBox2dCollisionAlgorithm::processCollision(const btCollisionObjectWra
if (!m_manifoldPtr)
return;

const btBox2dShape* box0 = (const btBox2dShape*)body0Wrap->getCollisionShape();
const btBox2dShape* box1 = (const btBox2dShape*)body1Wrap->getCollisionShape();
const btBox2dShape* box0 = (const btBox2dShape*)body0Wrap->m_collisionShape;
const btBox2dShape* box1 = (const btBox2dShape*)body1Wrap->m_collisionShape;

resultOut->setPersistentManifold(m_manifoldPtr);

b2CollidePolygons(resultOut, box0, body0Wrap->getWorldTransform(), box1, body1Wrap->getWorldTransform());
b2CollidePolygons(resultOut, box0, body0Wrap->m_worldTransform, box1, body1Wrap->m_worldTransform);

// refreshContactPoints is only necessary when using persistent contact points. otherwise all points are newly added
if (m_ownManifold)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ btBoxBoxCollisionAlgorithm::btBoxBoxCollisionAlgorithm(btPersistentManifold* mf,
m_ownManifold(false),
m_manifoldPtr(mf)
{
if (!m_manifoldPtr && m_dispatcher->needsCollision(body0Wrap->getCollisionObject(), body1Wrap->getCollisionObject()))
if (!m_manifoldPtr && m_dispatcher->needsCollision(body0Wrap->m_collisionObject, body1Wrap->m_collisionObject))
{
m_manifoldPtr = m_dispatcher->getNewManifold(body0Wrap->getCollisionObject(), body1Wrap->getCollisionObject());
m_manifoldPtr = m_dispatcher->getNewManifold(body0Wrap->m_collisionObject, body1Wrap->m_collisionObject);
m_ownManifold = true;
}
}
Expand All @@ -47,8 +47,8 @@ void btBoxBoxCollisionAlgorithm::processCollision(const btCollisionObjectWrapper
if (!m_manifoldPtr)
return;

const btBoxShape* box0 = (btBoxShape*)body0Wrap->getCollisionShape();
const btBoxShape* box1 = (btBoxShape*)body1Wrap->getCollisionShape();
const btBoxShape* box0 = (btBoxShape*)body0Wrap->m_collisionShape;
const btBoxShape* box1 = (btBoxShape*)body1Wrap->m_collisionShape;

/// report a contact. internally this will be kept persistent, and contact reduction is done
resultOut->setPersistentManifold(m_manifoldPtr);
Expand All @@ -58,8 +58,8 @@ void btBoxBoxCollisionAlgorithm::processCollision(const btCollisionObjectWrapper

btDiscreteCollisionDetectorInterface::ClosestPointInput input;
input.m_maximumDistanceSquared = BT_LARGE_FLOAT;
input.m_transformA = body0Wrap->getWorldTransform();
input.m_transformB = body1Wrap->getWorldTransform();
input.m_transformA = body0Wrap->m_worldTransform;
input.m_transformB = body1Wrap->m_worldTransform;

btBoxBoxDetector detector(box0, box1);
detector.getClosestPoints(input, *resultOut, dispatchInfo.m_debugDraw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ btPersistentManifold* btCollisionDispatcher::getNewManifold(const btCollisionObj

//optional relative contact breaking threshold, turned on by default (use setDispatcherFlags to switch off feature for improved performance)

btScalar contactBreakingThreshold = (m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD) ? btMin(body0->getCollisionShape()->getContactBreakingThreshold(gContactBreakingThreshold), body1->getCollisionShape()->getContactBreakingThreshold(gContactBreakingThreshold))
btScalar contactBreakingThreshold = (m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD) ? btMin(body0->m_collisionShape->getContactBreakingThreshold(gContactBreakingThreshold), body1->m_collisionShape->getContactBreakingThreshold(gContactBreakingThreshold))
: gContactBreakingThreshold;

btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(), body1->getContactProcessingThreshold());
btScalar contactProcessingThreshold = btMin(body0->m_contactProcessingThreshold, body1->m_contactProcessingThreshold);

void* mem = m_persistentManifoldPoolAllocator->allocate(sizeof(btPersistentManifold));
if (NULL == mem)
Expand Down Expand Up @@ -134,11 +134,11 @@ btCollisionAlgorithm* btCollisionDispatcher::findAlgorithm(const btCollisionObje
btCollisionAlgorithm* algo = 0;
if (algoType == BT_CONTACT_POINT_ALGORITHMS)
{
algo = m_doubleDispatchContactPoints[body0Wrap->getCollisionShape()->getShapeType()][body1Wrap->getCollisionShape()->getShapeType()]->CreateCollisionAlgorithm(ci, body0Wrap, body1Wrap);
algo = m_doubleDispatchContactPoints[body0Wrap->m_collisionShape->getShapeType()][body1Wrap->m_collisionShape->getShapeType()]->CreateCollisionAlgorithm(ci, body0Wrap, body1Wrap);
}
else
{
algo = m_doubleDispatchClosestPoints[body0Wrap->getCollisionShape()->getShapeType()][body1Wrap->getCollisionShape()->getShapeType()]->CreateCollisionAlgorithm(ci, body0Wrap, body1Wrap);
algo = m_doubleDispatchClosestPoints[body0Wrap->m_collisionShape->getShapeType()][body1Wrap->m_collisionShape->getShapeType()]->CreateCollisionAlgorithm(ci, body0Wrap, body1Wrap);
}

return algo;
Expand Down Expand Up @@ -235,8 +235,8 @@ void btCollisionDispatcher::defaultNearCallback(btBroadphasePair& collisionPair,

if (dispatcher.needsCollision(colObj0, colObj1))
{
btCollisionObjectWrapper obj0Wrap(0, colObj0->getCollisionShape(), colObj0, colObj0->getWorldTransform(), -1, -1);
btCollisionObjectWrapper obj1Wrap(0, colObj1->getCollisionShape(), colObj1, colObj1->getWorldTransform(), -1, -1);
btCollisionObjectWrapper obj0Wrap(0, colObj0->m_collisionShape, colObj0, colObj0->m_worldTransform, -1, -1);
btCollisionObjectWrapper obj1Wrap(0, colObj1->m_collisionShape, colObj1, colObj1->m_worldTransform, -1, -1);

//dispatcher will keep algorithms persistent in the collision pair
if (!collisionPair.m_algorithm)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ btPersistentManifold* btCollisionDispatcherMt::getNewManifold(const btCollisionO
{
//optional relative contact breaking threshold, turned on by default (use setDispatcherFlags to switch off feature for improved performance)

btScalar contactBreakingThreshold = (m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD) ? btMin(body0->getCollisionShape()->getContactBreakingThreshold(gContactBreakingThreshold), body1->getCollisionShape()->getContactBreakingThreshold(gContactBreakingThreshold))
btScalar contactBreakingThreshold = (m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD) ? btMin(body0->m_collisionShape->getContactBreakingThreshold(gContactBreakingThreshold), body1->m_collisionShape->getContactBreakingThreshold(gContactBreakingThreshold))
: gContactBreakingThreshold;

btScalar contactProcessingThreshold = btMin(body0->getContactProcessingThreshold(), body1->getContactProcessingThreshold());
btScalar contactProcessingThreshold = btMin(body0->m_contactProcessingThreshold, body1->m_contactProcessingThreshold);

void* mem = m_persistentManifoldPoolAllocator->allocate(sizeof(btPersistentManifold));
if (NULL == mem)
Expand Down
Loading

0 comments on commit fc97500

Please sign in to comment.