PhysicsDirect.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef PHYSICS_DIRECT_H
  2. #define PHYSICS_DIRECT_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. ///PhysicsDirect executes the commands directly, without transporting them or having a separate server executing commands
  10. class PhysicsDirect : public PhysicsClient
  11. {
  12. protected:
  13. struct PhysicsDirectInternalData* m_data;
  14. bool processDebugLines(const struct SharedMemoryCommand& orgCommand);
  15. public:
  16. PhysicsDirect();
  17. virtual ~PhysicsDirect();
  18. // return true if connection succesfull, can also check 'isConnected'
  19. virtual bool connect();
  20. ////todo: rename to 'disconnect'
  21. virtual void disconnectSharedMemory();
  22. virtual bool isConnected() const;
  23. // return non-null if there is a status, nullptr otherwise
  24. virtual const SharedMemoryStatus* processServerStatus();
  25. virtual SharedMemoryCommand* getAvailableSharedMemoryCommand();
  26. virtual bool canSubmitCommand() const;
  27. virtual bool submitClientCommand(const struct SharedMemoryCommand& command);
  28. virtual int getNumJoints(int bodyIndex) const;
  29. virtual void 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. };
  38. #endif //PHYSICS_DIRECT_H