Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:36:08 AM (16 years ago)
Author:
dafrick
Message:

Merging of the current QuestSystem branch.

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h

    r2662 r2907  
    2424
    2525
    26 ///The btSequentialImpulseConstraintSolver uses a Propagation Method and Sequentially applies impulses
    27 ///The approach is the 3D version of Erin Catto's GDC 2006 tutorial. See http://www.gphysics.com
    28 ///Although Sequential Impulse is more intuitive, it is mathematically equivalent to Projected Successive Overrelaxation (iterative LCP)
    29 ///Applies impulses for combined restitution and penetration recovery and to simulate friction
     26
     27///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (iterative LCP) method.
    3028class btSequentialImpulseConstraintSolver : public btConstraintSolver
    3129{
     30protected:
    3231
    3332        btAlignedObjectArray<btSolverBody>      m_tmpSolverBodyPool;
    34         btAlignedObjectArray<btSolverConstraint>        m_tmpSolverConstraintPool;
    35         btAlignedObjectArray<btSolverConstraint>        m_tmpSolverFrictionConstraintPool;
     33        btConstraintArray                       m_tmpSolverContactConstraintPool;
     34        btConstraintArray                       m_tmpSolverNonContactConstraintPool;
     35        btConstraintArray                       m_tmpSolverContactFrictionConstraintPool;
    3636        btAlignedObjectArray<int>       m_orderTmpConstraintPool;
    3737        btAlignedObjectArray<int>       m_orderFrictionConstraintPool;
    3838
    39 
    40 protected:
    41         btScalar solve(btRigidBody* body0,btRigidBody* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer);
    42         btScalar solveFriction(btRigidBody* body0,btRigidBody* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer);
    43         void  prepareConstraints(btPersistentManifold* manifoldPtr, const btContactSolverInfo& info,btIDebugDraw* debugDrawer);
    4439        btSolverConstraint&     addFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation);
    45 
    46         ContactSolverFunc m_contactDispatch[MAX_CONTACT_SOLVER_TYPES][MAX_CONTACT_SOLVER_TYPES];
    47         ContactSolverFunc m_frictionDispatch[MAX_CONTACT_SOLVER_TYPES][MAX_CONTACT_SOLVER_TYPES];
    48 
    4940       
    5041        ///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction
    5142        unsigned long   m_btSeed2;
    5243
     44        void    initSolverBody(btSolverBody* solverBody, btCollisionObject* collisionObject);
     45        btScalar restitutionCurve(btScalar rel_vel, btScalar restitution);
     46
     47        void    convertContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal);
     48
     49        void    resolveSplitPenetrationImpulseCacheFriendly(
     50        btSolverBody& body1,
     51        btSolverBody& body2,
     52        const btSolverConstraint& contactConstraint,
     53        const btContactSolverInfo& solverInfo);
     54
     55        //internal method
     56        int     getOrInitSolverBody(btCollisionObject& body);
     57
     58        void    resolveSingleConstraintRowGeneric(btSolverBody& body1,btSolverBody& body2,const btSolverConstraint& contactConstraint);
     59
     60        void    resolveSingleConstraintRowGenericSIMD(btSolverBody& body1,btSolverBody& body2,const btSolverConstraint& contactConstraint);
     61       
     62        void    resolveSingleConstraintRowLowerLimit(btSolverBody& body1,btSolverBody& body2,const btSolverConstraint& contactConstraint);
     63       
     64        void    resolveSingleConstraintRowLowerLimitSIMD(btSolverBody& body1,btSolverBody& body2,const btSolverConstraint& contactConstraint);
     65               
    5366public:
    5467
    5568       
    5669        btSequentialImpulseConstraintSolver();
     70        virtual ~btSequentialImpulseConstraintSolver();
    5771
    58         ///Advanced: Override the default contact solving function for contacts, for certain types of rigidbody
    59         ///See btRigidBody::m_contactSolverType and btRigidBody::m_frictionSolverType
    60         void    setContactSolverFunc(ContactSolverFunc func,int type0,int type1)
    61         {
    62                 m_contactDispatch[type0][type1] = func;
    63         }
     72        virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher);
    6473       
    65         ///Advanced: Override the default friction solving function for contacts, for certain types of rigidbody
    66         ///See btRigidBody::m_contactSolverType and btRigidBody::m_frictionSolverType
    67         void    SetFrictionSolverFunc(ContactSolverFunc func,int type0,int type1)
    68         {
    69                 m_frictionDispatch[type0][type1] = func;
    70         }
    71 
    72         virtual ~btSequentialImpulseConstraintSolver();
    73        
    74         virtual btScalar solveGroup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifold,int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btStackAlloc* stackAlloc,btDispatcher* dispatcher);
    75 
    76         virtual btScalar solveGroupCacheFriendly(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
     74        btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
    7775        btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
    78         btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
    79 
    8076
    8177        ///clear internal cached data and reset random seed
    8278        virtual void    reset();
    83 
    84         btScalar solveCombinedContactFriction(btRigidBody* body0,btRigidBody* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer);
    85 
    86 
    8779       
    8880        unsigned long btRand2();
Note: See TracChangeset for help on using the changeset viewer.