Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 28, 2011, 7:15:14 AM (14 years ago)
Author:
rgrieder
Message:

Merged kicklib2 branch back to trunk (includes former branches ois_update, mac_osx and kicklib).

Notes for updating

Linux:
You don't need an extra package for CEGUILua and Tolua, it's already shipped with CEGUI.
However you do need to make sure that the OgreRenderer is installed too with CEGUI 0.7 (may be a separate package).
Also, Orxonox now recognises if you install the CgProgramManager (a separate package available on newer Ubuntu on Debian systems).

Windows:
Download the new dependency packages versioned 6.0 and use these. If you have problems with that or if you don't like the in game console problem mentioned below, you can download the new 4.3 version of the packages (only available for Visual Studio 2005/2008).

Key new features:

  • *Support for Mac OS X*
  • Visual Studio 2010 support
  • Bullet library update to 2.77
  • OIS library update to 1.3
  • Support for CEGUI 0.7 —> Support for Arch Linux and even SuSE
  • Improved install target
  • Compiles now with GCC 4.6
  • Ogre Cg Shader plugin activated for Linux if available
  • And of course lots of bug fixes

There are also some regressions:

  • No support for CEGUI 0.5, Ogre 1.4 and boost 1.35 - 1.39 any more
  • In game console is not working in main menu for CEGUI 0.7
  • Tolua (just the C lib, not the application) and CEGUILua libraries are no longer in our repository. —> You will need to get these as well when compiling Orxonox
  • And of course lots of new bugs we don't yet know about
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp

    r5781 r8351  
    3939
    4040
    41 
    4241btGjkPairDetector::btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*  penetrationDepthSolver)
    43 :m_cachedSeparatingAxis(btScalar(0.),btScalar(0.),btScalar(1.)),
     42:m_cachedSeparatingAxis(btScalar(0.),btScalar(1.),btScalar(0.)),
    4443m_penetrationDepthSolver(penetrationDepthSolver),
    4544m_simplexSolver(simplexSolver),
    4645m_minkowskiA(objectA),
    4746m_minkowskiB(objectB),
     47m_shapeTypeA(objectA->getShapeType()),
     48m_shapeTypeB(objectB->getShapeType()),
     49m_marginA(objectA->getMargin()),
     50m_marginB(objectB->getMargin()),
    4851m_ignoreMargin(false),
    4952m_lastUsedMethod(-1),
     
    5154{
    5255}
    53 
    54 void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults)
     56btGjkPairDetector::btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,int shapeTypeA,int shapeTypeB,btScalar marginA, btScalar marginB, btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*        penetrationDepthSolver)
     57:m_cachedSeparatingAxis(btScalar(0.),btScalar(1.),btScalar(0.)),
     58m_penetrationDepthSolver(penetrationDepthSolver),
     59m_simplexSolver(simplexSolver),
     60m_minkowskiA(objectA),
     61m_minkowskiB(objectB),
     62m_shapeTypeA(shapeTypeA),
     63m_shapeTypeB(shapeTypeB),
     64m_marginA(marginA),
     65m_marginB(marginB),
     66m_ignoreMargin(false),
     67m_lastUsedMethod(-1),
     68m_catchDegeneracies(1)
     69{
     70}
     71
     72void    btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw,bool swapResults)
     73{
     74        (void)swapResults;
     75
     76        getClosestPointsNonVirtual(input,output,debugDraw);
     77}
     78
     79#ifdef __SPU__
     80void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
     81#else
     82void btGjkPairDetector::getClosestPointsNonVirtual(const ClosestPointInput& input,Result& output,class btIDebugDraw* debugDraw)
     83#endif
    5584{
    5685        m_cachedSeparatingDistance = 0.f;
     
    6594        localTransB.getOrigin() -= positionOffset;
    6695
    67 #ifdef __SPU__
    68         btScalar marginA = m_minkowskiA->getMarginNonVirtual();
    69         btScalar marginB = m_minkowskiB->getMarginNonVirtual();
    70 #else
    71         btScalar marginA = m_minkowskiA->getMargin();
    72         btScalar marginB = m_minkowskiB->getMargin();
    73 #ifdef TEST_NON_VIRTUAL
    74         btScalar marginAv = m_minkowskiA->getMarginNonVirtual();
    75         btScalar marginBv = m_minkowskiB->getMarginNonVirtual();
    76         btAssert(marginA == marginAv);
    77         btAssert(marginB == marginBv);
    78 #endif //TEST_NON_VIRTUAL
    79 #endif
    80        
    81 
     96        bool check2d = m_minkowskiA->isConvex2d() && m_minkowskiB->isConvex2d();
     97
     98        btScalar marginA = m_marginA;
     99        btScalar marginB = m_marginB;
    82100
    83101        gNumGjkChecks++;
     
    108126
    109127        {
    110                 btScalar squaredDistance = SIMD_INFINITY;
     128                btScalar squaredDistance = BT_LARGE_FLOAT;
    111129                btScalar delta = btScalar(0.);
    112130               
     
    124142                        btVector3 seperatingAxisInB = m_cachedSeparatingAxis* input.m_transformB.getBasis();
    125143
     144#if 1
     145
     146                        btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInA);
     147                        btVector3 qInB = m_minkowskiB->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInB);
     148
     149//                      btVector3 pInA  = localGetSupportingVertexWithoutMargin(m_shapeTypeA, m_minkowskiA, seperatingAxisInA,input.m_convexVertexData[0]);//, &featureIndexA);
     150//                      btVector3 qInB  = localGetSupportingVertexWithoutMargin(m_shapeTypeB, m_minkowskiB, seperatingAxisInB,input.m_convexVertexData[1]);//, &featureIndexB);
     151
     152#else
    126153#ifdef __SPU__
    127154                        btVector3 pInA = m_minkowskiA->localGetSupportVertexWithoutMarginNonVirtual(seperatingAxisInA);
     
    137164#endif //
    138165#endif //__SPU__
     166#endif
     167
    139168
    140169                        btVector3  pWorld = localTransA(pInA); 
     
    145174#endif
    146175
     176                        if (check2d)
     177                        {
     178                                pWorld[2] = 0.f;
     179                                qWorld[2] = 0.f;
     180                        }
     181
    147182                        btVector3 w     = pWorld - qWorld;
    148183                        delta = m_cachedSeparatingAxis.dot(w);
     
    151186                        if ((delta > btScalar(0.0)) && (delta * delta > squaredDistance * input.m_maximumDistanceSquared))
    152187                        {
     188                                m_degenerateSimplex = 10;
    153189                                checkSimplex=true;
    154190                                //checkPenetration = false;
     
    172208                                {
    173209                                        m_degenerateSimplex = 2;
     210                                } else
     211                                {
     212                                        m_degenerateSimplex = 11;
    174213                                }
    175214                                checkSimplex = true;
     
    185224                spu_printf("addVertex 2\n");
    186225#endif
     226                        btVector3 newCachedSeparatingAxis;
     227
    187228                        //calculate the closest point to the origin (update vector v)
    188                         if (!m_simplexSolver->closest(m_cachedSeparatingAxis))
     229                        if (!m_simplexSolver->closest(newCachedSeparatingAxis))
    189230                        {
    190231                                m_degenerateSimplex = 3;
     
    193234                        }
    194235
    195                         if(m_cachedSeparatingAxis.length2()<REL_ERROR2)
     236                        if(newCachedSeparatingAxis.length2()<REL_ERROR2)
    196237            {
     238                                m_cachedSeparatingAxis = newCachedSeparatingAxis;
    197239                m_degenerateSimplex = 6;
    198240                checkSimplex = true;
     
    201243
    202244                        btScalar previousSquaredDistance = squaredDistance;
    203                         squaredDistance = m_cachedSeparatingAxis.length2();
     245                        squaredDistance = newCachedSeparatingAxis.length2();
     246#if 0
     247///warning: this termination condition leads to some problems in 2d test case see Bullet/Demos/Box2dDemo
     248                        if (squaredDistance>previousSquaredDistance)
     249                        {
     250                                m_degenerateSimplex = 7;
     251                                squaredDistance = previousSquaredDistance;
     252                checkSimplex = false;
     253                break;
     254                        }
     255#endif //
    204256                       
     257                        m_cachedSeparatingAxis = newCachedSeparatingAxis;
     258
    205259                        //redundant m_simplexSolver->compute_points(pointOnA, pointOnB);
    206260
     
    210264                                m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
    211265                                checkSimplex = true;
     266                                m_degenerateSimplex = 12;
     267                               
    212268                                break;
    213269                        }
     
    240296                                //do we need this backup_closest here ?
    241297                                m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
     298                                m_degenerateSimplex = 13;
    242299                                break;
    243300                        }
     
    248305                        m_simplexSolver->compute_points(pointOnA, pointOnB);
    249306                        normalInB = pointOnA-pointOnB;
    250                         btScalar lenSqr = m_cachedSeparatingAxis.length2();
     307                        btScalar lenSqr =m_cachedSeparatingAxis.length2();
     308                       
    251309                        //valid normal
    252310                        if (lenSqr < 0.0001)
     
    280338                {
    281339                        //penetration case
    282                
     340
    283341                        //if there is no way to handle penetrations, bail out
    284342                        if (m_penetrationDepthSolver)
     
    288346                               
    289347                                gNumDeepPenetrationChecks++;
     348                                m_cachedSeparatingAxis.setZero();
    290349
    291350                                bool isValid2 = m_penetrationDepthSolver->calcPenDepth(
     
    297356                                        );
    298357
     358
    299359                                if (isValid2)
    300360                                {
    301361                                        btVector3 tmpNormalInB = tmpPointOnB-tmpPointOnA;
    302362                                        btScalar lenSqr = tmpNormalInB.length2();
     363                                        if (lenSqr <= (SIMD_EPSILON*SIMD_EPSILON))
     364                                        {
     365                                                tmpNormalInB = m_cachedSeparatingAxis;
     366                                                lenSqr = m_cachedSeparatingAxis.length2();
     367                                        }
     368
    303369                                        if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON))
    304370                                        {
     
    316382                                                } else
    317383                                                {
    318                                                        
     384                                                        m_lastUsedMethod = 8;
    319385                                                }
    320386                                        } else
    321387                                        {
    322                                                 //isValid = false;
    323                                                 m_lastUsedMethod = 4;
     388                                                m_lastUsedMethod = 9;
    324389                                        }
    325390                                } else
     391
    326392                                {
    327                                         m_lastUsedMethod = 5;
     393                                        ///this is another degenerate case, where the initial GJK calculation reports a degenerate case
     394                                        ///EPA reports no penetration, and the second GJK (using the supporting vector without margin)
     395                                        ///reports a valid positive distance. Use the results of the second GJK instead of failing.
     396                                        ///thanks to Jacob.Langford for the reproduction case
     397                                        ///http://code.google.com/p/bullet/issues/detail?id=250
     398
     399                               
     400                                        if (m_cachedSeparatingAxis.length2() > btScalar(0.))
     401                                        {
     402                                                btScalar distance2 = (tmpPointOnA-tmpPointOnB).length()-margin;
     403                                                //only replace valid distances when the distance is less
     404                                                if (!isValid || (distance2 < distance))
     405                                                {
     406                                                        distance = distance2;
     407                                                        pointOnA = tmpPointOnA;
     408                                                        pointOnB = tmpPointOnB;
     409                                                        pointOnA -= m_cachedSeparatingAxis * marginA ;
     410                                                        pointOnB += m_cachedSeparatingAxis * marginB ;
     411                                                        normalInB = m_cachedSeparatingAxis;
     412                                                        normalInB.normalize();
     413                                                        isValid = true;
     414                                                        m_lastUsedMethod = 6;
     415                                                } else
     416                                                {
     417                                                        m_lastUsedMethod = 5;
     418                                                }
     419                                        }
    328420                                }
    329421                               
    330422                        }
     423
    331424                }
    332425        }
    333426
    334         if (isValid)
     427       
     428
     429        if (isValid && ((distance < 0) || (distance*distance < input.m_maximumDistanceSquared)))
    335430        {
    336 #ifdef __SPU__
    337                 //spu_printf("distance\n");
    338 #endif //__CELLOS_LV2__
    339 
    340 
    341 #ifdef DEBUG_SPU_COLLISION_DETECTION
    342                 spu_printf("output 1\n");
    343 #endif
     431#if 0
     432///some debugging
     433//              if (check2d)
     434                {
     435                        printf("n = %2.3f,%2.3f,%2.3f. ",normalInB[0],normalInB[1],normalInB[2]);
     436                        printf("distance = %2.3f exit=%d deg=%d\n",distance,m_lastUsedMethod,m_degenerateSimplex);
     437                }
     438#endif
     439
    344440                m_cachedSeparatingAxis = normalInB;
    345441                m_cachedSeparatingDistance = distance;
     
    350446                        distance);
    351447
    352 #ifdef DEBUG_SPU_COLLISION_DETECTION
    353                 spu_printf("output 2\n");
    354 #endif
    355                 //printf("gjk add:%f",distance);
    356448        }
    357449
Note: See TracChangeset for help on using the changeset viewer.