Changeset 2908 for code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h
- Timestamp:
- Apr 8, 2009, 12:58:47 AM (16 years ago)
- Location:
- code/branches/questsystem5
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/questsystem5
- Property svn:mergeinfo changed
-
code/branches/questsystem5/src/bullet/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h
r2907 r2908 24 24 25 25 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 28 30 class btSequentialImpulseConstraintSolver : public btConstraintSolver 29 31 { 30 protected:31 32 32 33 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; 36 36 btAlignedObjectArray<int> m_orderTmpConstraintPool; 37 37 btAlignedObjectArray<int> m_orderFrictionConstraintPool; 38 38 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); 39 44 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 40 49 41 50 ///m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction 42 51 unsigned long m_btSeed2; 43 52 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 method56 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 66 53 public: 67 54 68 55 69 56 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 70 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); 71 75 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); 74 78 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 76 80 77 81 ///clear internal cached data and reset random seed 78 82 virtual void reset(); 83 84 btScalar solveCombinedContactFriction(btRigidBody* body0,btRigidBody* body1, btManifoldPoint& cp, const btContactSolverInfo& info,int iter,btIDebugDraw* debugDrawer); 85 86 79 87 80 88 unsigned long btRand2();
Note: See TracChangeset
for help on using the changeset viewer.