2
0

PhysicsLoopBack.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 getNumJoints(int bodyIndex) const;
  26. virtual void getJointInfo(int bodyIndex, int jointIndex, struct b3JointInfo& info) const;
  27. ///todo: move this out of the
  28. virtual void setSharedMemoryKey(int key);
  29. void uploadBulletFileToSharedMemory(const char* data, int len);
  30. virtual int getNumDebugLines() const;
  31. virtual const float* getDebugLinesFrom() const;
  32. virtual const float* getDebugLinesTo() const;
  33. virtual const float* getDebugLinesColor() const;
  34. };
  35. #endif //PHYSICS_LOOP_BACK_H