b3GpuSolverConstraint.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Bullet Continuous Collision Detection and Physics Library
  3. Copyright (c) 2013 Erwin Coumans http://github.com/erwincoumans/bullet3
  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 B3_GPU_SOLVER_CONSTRAINT_H
  14. #define B3_GPU_SOLVER_CONSTRAINT_H
  15. #include "Bullet3Common/b3Vector3.h"
  16. #include "Bullet3Common/b3Matrix3x3.h"
  17. //#include "b3JacobianEntry.h"
  18. #include "Bullet3Common/b3AlignedObjectArray.h"
  19. //#define NO_FRICTION_TANGENTIALS 1
  20. ///1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and friction constraints.
  21. B3_ATTRIBUTE_ALIGNED16(struct)
  22. b3GpuSolverConstraint
  23. {
  24. B3_DECLARE_ALIGNED_ALLOCATOR();
  25. b3Vector3 m_relpos1CrossNormal;
  26. b3Vector3 m_contactNormal;
  27. b3Vector3 m_relpos2CrossNormal;
  28. //b3Vector3 m_contactNormal2;//usually m_contactNormal2 == -m_contactNormal
  29. b3Vector3 m_angularComponentA;
  30. b3Vector3 m_angularComponentB;
  31. mutable b3Scalar m_appliedPushImpulse;
  32. mutable b3Scalar m_appliedImpulse;
  33. int m_padding1;
  34. int m_padding2;
  35. b3Scalar m_friction;
  36. b3Scalar m_jacDiagABInv;
  37. b3Scalar m_rhs;
  38. b3Scalar m_cfm;
  39. b3Scalar m_lowerLimit;
  40. b3Scalar m_upperLimit;
  41. b3Scalar m_rhsPenetration;
  42. union {
  43. void* m_originalContactPoint;
  44. int m_originalConstraintIndex;
  45. b3Scalar m_unusedPadding4;
  46. };
  47. int m_overrideNumSolverIterations;
  48. int m_frictionIndex;
  49. int m_solverBodyIdA;
  50. int m_solverBodyIdB;
  51. enum b3SolverConstraintType
  52. {
  53. B3_SOLVER_CONTACT_1D = 0,
  54. B3_SOLVER_FRICTION_1D
  55. };
  56. };
  57. typedef b3AlignedObjectArray<b3GpuSolverConstraint> b3GpuConstraintArray;
  58. #endif //B3_GPU_SOLVER_CONSTRAINT_H