PhysicsServerCommandProcessor.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef PHYSICS_SERVER_COMMAND_PROCESSOR_H
  2. #define PHYSICS_SERVER_COMMAND_PROCESSOR_H
  3. #include "LinearMath/btVector3.h"
  4. struct SharedMemLines
  5. {
  6. btVector3 m_from;
  7. btVector3 m_to;
  8. btVector3 m_color;
  9. };
  10. ///todo: naming. Perhaps PhysicsSdkCommandprocessor?
  11. class PhysicsServerCommandProcessor
  12. {
  13. struct PhysicsServerCommandProcessorInternalData* m_data;
  14. protected:
  15. bool loadSdf(const char* fileName, char* bufferServerToClient, int bufferSizeInBytes, bool useMultiBody);
  16. bool loadUrdf(const char* fileName, const class btVector3& pos, const class btQuaternion& orn,
  17. bool useMultiBody, bool useFixedBase, int* bodyUniqueIdPtr, char* bufferServerToClient, int bufferSizeInBytes);
  18. bool supportsJointMotor(class btMultiBody* body, int linkIndex);
  19. int createBodyInfoStream(int bodyUniqueId, char* bufferServerToClient, int bufferSizeInBytes);
  20. void deleteCachedInverseDynamicsBodies();
  21. public:
  22. PhysicsServerCommandProcessor();
  23. virtual ~PhysicsServerCommandProcessor();
  24. void createJointMotors(class btMultiBody* body);
  25. virtual void createEmptyDynamicsWorld();
  26. virtual void deleteDynamicsWorld();
  27. virtual bool processCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes );
  28. virtual void renderScene();
  29. virtual void physicsDebugDraw(int debugDrawFlags);
  30. virtual void setGuiHelper(struct GUIHelperInterface* guiHelper);
  31. //@todo(erwincoumans) Should we have shared memory commands for picking objects?
  32. ///The pickBody method will try to pick the first body along a ray, return true if succeeds, false otherwise
  33. virtual bool pickBody(const btVector3& rayFromWorld, const btVector3& rayToWorld);
  34. virtual bool movePickedBody(const btVector3& rayFromWorld, const btVector3& rayToWorld);
  35. virtual void removePickingConstraint();
  36. void enableCommandLogging(bool enable, const char* fileName);
  37. void replayFromLogFile(const char* fileName);
  38. void replayLogCommand(char* bufferServerToClient, int bufferSizeInBytes );
  39. void stepSimulationRealTime(double dtInSec);
  40. void applyJointDamping(int bodyUniqueId);
  41. };
  42. #endif //PHYSICS_SERVER_COMMAND_PROCESSOR_H