Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 3, 2011, 5:07:42 AM (13 years ago)
Author:
rgrieder
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/external/bullet/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp

    r8351 r8393  
    2727#include "BulletCollision/CollisionShapes/btConvexShape.h"
    2828#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
     29#include "BulletCollision/CollisionShapes/btTriangleShape.h"
     30
    2931
    3032
     
    4951#include "BulletCollision/NarrowPhaseCollision/btGjkEpa2.h"
    5052#include "BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h"
    51 
     53#include "BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.h"
    5254
    5355
     
    332334
    333335
     336
     337
    334338#ifdef USE_SEPDISTANCE_UTIL2
    335339        if (dispatchInfo.m_useConvexConservativeDistanceUtil)
     
    358362#endif //USE_SEPDISTANCE_UTIL2
    359363        {
    360                 if (dispatchInfo.m_convexMaxDistanceUseCPT)
    361                 {
    362                         input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactProcessingThreshold();
    363                 } else
    364                 {
    365                         input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
    366                 }
     364                //if (dispatchInfo.m_convexMaxDistanceUseCPT)
     365                //{
     366                //      input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactProcessingThreshold();
     367                //} else
     368                //{
     369                input.m_maximumDistanceSquared = min0->getMargin() + min1->getMargin() + m_manifoldPtr->getContactBreakingThreshold();
     370//              }
     371
    367372                input.m_maximumDistanceSquared*= input.m_maximumDistanceSquared;
    368373        }
     
    372377        input.m_transformB = body1->getWorldTransform();
    373378
    374         gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
     379
    375380
    376381       
     
    389394        }
    390395#endif //USE_SEPDISTANCE_UTIL2
     396
     397        if (min0->isPolyhedral() && min1->isPolyhedral())
     398        {
     399
     400
     401                struct btDummyResult : public btDiscreteCollisionDetectorInterface::Result
     402                {
     403                        virtual void setShapeIdentifiersA(int partId0,int index0){}
     404                        virtual void setShapeIdentifiersB(int partId1,int index1){}
     405                        virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth)
     406                        {
     407                        }
     408                };
     409               
     410                btDummyResult dummy;
     411
     412
     413                btPolyhedralConvexShape* polyhedronA = (btPolyhedralConvexShape*) min0;
     414                btPolyhedralConvexShape* polyhedronB = (btPolyhedralConvexShape*) min1;
     415                if (polyhedronA->getConvexPolyhedron() && polyhedronB->getConvexPolyhedron())
     416                {
     417
     418
     419                        gjkPairDetector.getClosestPoints(input,dummy,dispatchInfo.m_debugDraw);
     420                       
     421
     422                        btScalar threshold = m_manifoldPtr->getContactBreakingThreshold();
     423
     424                        btScalar minDist = 0.f;
     425                        btVector3 sepNormalWorldSpace;
     426                        bool foundSepAxis  = true;
     427
     428                        if (dispatchInfo.m_enableSatConvex)
     429                        {
     430                                foundSepAxis = btPolyhedralContactClipping::findSeparatingAxis(
     431                                        *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
     432                                        body0->getWorldTransform(),
     433                                        body1->getWorldTransform(),
     434                                        sepNormalWorldSpace);
     435                        } else
     436                        {
     437                                sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
     438                                minDist = gjkPairDetector.getCachedSeparatingDistance();
     439                        }
     440                        if (foundSepAxis)
     441                        {
     442//                              printf("sepNormalWorldSpace=%f,%f,%f\n",sepNormalWorldSpace.getX(),sepNormalWorldSpace.getY(),sepNormalWorldSpace.getZ());
     443
     444                                btPolyhedralContactClipping::clipHullAgainstHull(sepNormalWorldSpace, *polyhedronA->getConvexPolyhedron(), *polyhedronB->getConvexPolyhedron(),
     445                                        body0->getWorldTransform(),
     446                                        body1->getWorldTransform(), minDist-threshold, threshold, *resultOut);
     447                               
     448                        }
     449                        if (m_ownManifold)
     450                        {
     451                                resultOut->refreshContactPoints();
     452                        }
     453                        return;
     454
     455                } else
     456                {
     457                        //we can also deal with convex versus triangle (without connectivity data)
     458                        if (polyhedronA->getConvexPolyhedron() && polyhedronB->getShapeType()==TRIANGLE_SHAPE_PROXYTYPE)
     459                        {
     460                                gjkPairDetector.getClosestPoints(input,dummy,dispatchInfo.m_debugDraw);
     461               
     462                                btVector3 sepNormalWorldSpace = gjkPairDetector.getCachedSeparatingAxis().normalized();
     463
     464                                btVertexArray vertices;
     465                                btTriangleShape* tri = (btTriangleShape*)polyhedronB;
     466                                vertices.push_back(     body1->getWorldTransform()*tri->m_vertices1[0]);
     467                                vertices.push_back(     body1->getWorldTransform()*tri->m_vertices1[1]);
     468                                vertices.push_back(     body1->getWorldTransform()*tri->m_vertices1[2]);
     469
     470                                btScalar threshold = m_manifoldPtr->getContactBreakingThreshold();
     471                                btScalar minDist = gjkPairDetector.getCachedSeparatingDistance();
     472                                btPolyhedralContactClipping::clipFaceAgainstHull(sepNormalWorldSpace, *polyhedronA->getConvexPolyhedron(),
     473                                        body0->getWorldTransform(), vertices, minDist-threshold, threshold, *resultOut);
     474                               
     475                               
     476                                if (m_ownManifold)
     477                                {
     478                                        resultOut->refreshContactPoints();
     479                                }
     480                               
     481                                return;
     482                        }
     483                       
     484                }
     485
     486
     487        }
     488       
     489        gjkPairDetector.getClosestPoints(input,*resultOut,dispatchInfo.m_debugDraw);
    391490
    392491        //now perform 'm_numPerturbationIterations' collision queries with the perturbated collision objects
Note: See TracChangeset for help on using the changeset viewer.