btNNCGConstraintSolver.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. Bullet Continuous Collision Detection and Physics Library
  3. Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
  4. This software is provided 'as-is', without any express or implied warranty.
  5. In no event will the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it freely,
  8. subject to the following restrictions:
  9. 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  10. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  11. 3. This notice may not be removed or altered from any source distribution.
  12. */
  13. #ifndef BT_NNCG_CONSTRAINT_SOLVER_H
  14. #define BT_NNCG_CONSTRAINT_SOLVER_H
  15. #include "btSequentialImpulseConstraintSolver.h"
  16. ATTRIBUTE_ALIGNED16(class) btNNCGConstraintSolver : public btSequentialImpulseConstraintSolver
  17. {
  18. protected:
  19. btScalar m_deltafLengthSqrPrev;
  20. btAlignedObjectArray<btScalar> m_pNC; // p for None Contact constraints
  21. btAlignedObjectArray<btScalar> m_pC; // p for Contact constraints
  22. btAlignedObjectArray<btScalar> m_pCF; // p for ContactFriction constraints
  23. btAlignedObjectArray<btScalar> m_pCRF; // p for ContactRollingFriction constraints
  24. //These are recalculated in every iterations. We just keep these to prevent reallocation in each iteration.
  25. btAlignedObjectArray<btScalar> m_deltafNC; // deltaf for NoneContact constraints
  26. btAlignedObjectArray<btScalar> m_deltafC; // deltaf for Contact constraints
  27. btAlignedObjectArray<btScalar> m_deltafCF; // deltaf for ContactFriction constraints
  28. btAlignedObjectArray<btScalar> m_deltafCRF; // deltaf for ContactRollingFriction constraints
  29. protected:
  30. virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject** bodies,int numBodies,const btContactSolverInfo& infoGlobal);
  31. virtual btScalar solveSingleIteration(int iteration, btCollisionObject** bodies ,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
  32. virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
  33. public:
  34. BT_DECLARE_ALIGNED_ALLOCATOR();
  35. btNNCGConstraintSolver() : btSequentialImpulseConstraintSolver(), m_onlyForNoneContact(false) {}
  36. virtual btConstraintSolverType getSolverType() const
  37. {
  38. return BT_NNCG_SOLVER;
  39. }
  40. bool m_onlyForNoneContact;
  41. };
  42. #endif //BT_NNCG_CONSTRAINT_SOLVER_H