b3GpuJacobiContactSolver.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef B3_GPU_JACOBI_CONTACT_SOLVER_H
  2. #define B3_GPU_JACOBI_CONTACT_SOLVER_H
  3. #include "Bullet3OpenCL/Initialize/b3OpenCLInclude.h"
  4. //#include "Bullet3Collision/NarrowPhaseCollision/shared/b3RigidBodyData.h"
  5. #include "Bullet3Collision/NarrowPhaseCollision/shared/b3RigidBodyData.h"
  6. #include "Bullet3Collision/NarrowPhaseCollision/shared/b3Contact4Data.h"
  7. #include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
  8. //struct b3InertiaData;
  9. //b3InertiaData
  10. class b3TypedConstraint;
  11. struct b3JacobiSolverInfo
  12. {
  13. int m_fixedBodyIndex;
  14. float m_deltaTime;
  15. float m_positionDrift;
  16. float m_positionConstraintCoeff;
  17. int m_numIterations;
  18. b3JacobiSolverInfo()
  19. : m_fixedBodyIndex(0),
  20. m_deltaTime(1. / 60.f),
  21. m_positionDrift(0.005f),
  22. m_positionConstraintCoeff(0.99f),
  23. m_numIterations(7)
  24. {
  25. }
  26. };
  27. class b3GpuJacobiContactSolver
  28. {
  29. protected:
  30. struct b3GpuJacobiSolverInternalData* m_data;
  31. cl_context m_context;
  32. cl_device_id m_device;
  33. cl_command_queue m_queue;
  34. public:
  35. b3GpuJacobiContactSolver(cl_context ctx, cl_device_id device, cl_command_queue queue, int pairCapacity);
  36. virtual ~b3GpuJacobiContactSolver();
  37. void solveContacts(int numBodies, cl_mem bodyBuf, cl_mem inertiaBuf, int numContacts, cl_mem contactBuf, const struct b3Config& config, int static0Index);
  38. void solveGroupHost(b3RigidBodyData* bodies, b3InertiaData* inertias, int numBodies, struct b3Contact4* manifoldPtr, int numManifolds, const b3JacobiSolverInfo& solverInfo);
  39. //void solveGroupHost(btRigidBodyCL* bodies,b3InertiaData* inertias,int numBodies,btContact4* manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btJacobiSolverInfo& solverInfo);
  40. //b3Scalar solveGroup(b3OpenCLArray<b3RigidBodyData>* gpuBodies,b3OpenCLArray<b3InertiaData>* gpuInertias, int numBodies,b3OpenCLArray<b3GpuGenericConstraint>* gpuConstraints,int numConstraints,const b3ContactSolverInfo& infoGlobal);
  41. //void solveGroup(btOpenCLArray<btRigidBodyCL>* bodies,btOpenCLArray<btInertiaCL>* inertias,btOpenCLArray<btContact4>* manifoldPtr,const btJacobiSolverInfo& solverInfo);
  42. //void solveGroupMixed(btOpenCLArray<btRigidBodyCL>* bodies,btOpenCLArray<btInertiaCL>* inertias,btOpenCLArray<btContact4>* manifoldPtr,const btJacobiSolverInfo& solverInfo);
  43. };
  44. #endif //B3_GPU_JACOBI_CONTACT_SOLVER_H