Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Reverted to revision 2906 (because I'm too stupid to merge correctly, 2nd try will follow shortly. ;))

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

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

    r2907 r2908  
    2424
    2525
    26 
    27 ///The btSequentialImpulseConstraintSolver is a fast SIMD implementation of the Projected Gauss Seidel (iterative LCP) method.
     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
    2830class btSequentialImpulseConstraintSolver : public btConstraintSolver
    2931{
    30 protected:
    3132
    3233        btAlignedObjectArray<btSolverBody>      m_tmpSolverBodyPool;
    33         btConstraintArray                       m_tmpSolverContactConstraintPool;
    34         btConstraintArray                       m_tmpSolverNonContactConstraintPool;
    35         btConstraintArray                       m_tmpSolverContactFrictionConstraintPool;
     34        btAlignedObjectArray<btSolverConstraint>        m_tmpSolverConstraintPool;
     35        btAlignedObjectArray<btSolverConstraint>        m_tmpSolverFrictionConstraintPool;
    3636        btAlignedObjectArray<int>       m_orderTmpConstraintPool;
    3737        btAlignedObjectArray<int>       m_orderFrictionConstraintPool;
    3838
     39
     40protected:
     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);
    3944        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
    4049       
    4150        ///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction
    4251        unsigned long   m_btSeed2;
    4352
    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                
    6653public:
    6754
    6855       
    6956        btSequentialImpulseConstraintSolver();
     57
     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        }
     64       
     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
    7072        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);
    7175
    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);
    73        
     76        virtual btScalar solveGroupCacheFriendly(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
     77        btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
    7478        btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
    75         btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer,btStackAlloc* stackAlloc);
     79
    7680
    7781        ///clear internal cached data and reset random seed
    7882        virtual void    reset();
     83
     84        btScalar solveCombinedContactFriction(btRigidBody* body0,btRigidBody* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer);
     85
     86
    7987       
    8088        unsigned long btRand2();
Note: See TracChangeset for help on using the changeset viewer.