PhysicsLoopBack.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef PHYSICS_LOOP_BACK_H
  2. #define PHYSICS_LOOP_BACK_H
  3. //#include "SharedMemoryCommands.h"
  4. #include "PhysicsClient.h"
  5. #include "LinearMath/btVector3.h"
  6. ///todo: the PhysicsClient API was designed with shared memory in mind,
  7. ///now it become more general we need to move out the shared memory specifics away
  8. ///for example naming [disconnectSharedMemory -> disconnect] [ move setSharedMemoryKey to shared memory specific subclass ]
  9. class PhysicsLoopBack : public PhysicsClient
  10. {
  11. struct PhysicsLoopBackInternalData* m_data;
  12. public:
  13. PhysicsLoopBack();
  14. virtual ~PhysicsLoopBack();
  15. // return true if connection succesfull, can also check 'isConnected'
  16. virtual bool connect();
  17. ////todo: rename to 'disconnect'
  18. virtual void disconnectSharedMemory();
  19. virtual bool isConnected() const;
  20. // return non-null if there is a status, nullptr otherwise
  21. virtual const SharedMemoryStatus* processServerStatus();
  22. virtual SharedMemoryCommand* getAvailableSharedMemoryCommand();
  23. virtual bool canSubmitCommand() const;
  24. virtual bool submitClientCommand(const struct SharedMemoryCommand& command);
  25. virtual int getNumBodies() const;
  26. virtual int getBodyUniqueId(int serialIndex) const;
  27. virtual bool getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) const;
  28. virtual int getNumJoints(int bodyIndex) const;
  29. virtual bool getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const;
  30. ///todo: move this out of the
  31. virtual void setSharedMemoryKey(int key);
  32. void uploadBulletFileToSharedMemory(const char* data, int len);
  33. virtual int getNumDebugLines() const;
  34. virtual const float* getDebugLinesFrom() const;
  35. virtual const float* getDebugLinesTo() const;
  36. virtual const float* getDebugLinesColor() const;
  37. virtual void getCachedCameraImage(struct b3CameraImageData* cameraData);
  38. virtual void getCachedContactPointInformation(struct b3ContactInformation* contactPointData);
  39. };
  40. #endif //PHYSICS_LOOP_BACK_H