2015-09-25 05:50:34 +00:00
|
|
|
#ifndef BT_PHYSICS_CLIENT_SHARED_MEMORY_API_H
|
|
|
|
#define BT_PHYSICS_CLIENT_SHARED_MEMORY_API_H
|
|
|
|
|
|
|
|
#include "PhysicsClient.h"
|
|
|
|
|
|
|
|
//#include "SharedMemoryCommands.h"
|
|
|
|
#include "LinearMath/btVector3.h"
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
class PhysicsClientSharedMemory : public PhysicsClient
|
|
|
|
{
|
2020-03-19 21:18:35 +00:00
|
|
|
|
2015-09-25 05:50:34 +00:00
|
|
|
|
|
|
|
protected:
|
2020-03-19 21:18:35 +00:00
|
|
|
struct PhysicsClientSharedMemoryInternalData* m_data;
|
2016-03-10 22:36:46 +00:00
|
|
|
virtual void setSharedMemoryInterface(class SharedMemoryInterface* sharedMem);
|
2018-09-23 21:17:31 +00:00
|
|
|
void processBodyJointInfo(int bodyUniqueId, const struct SharedMemoryStatus& serverCmd);
|
|
|
|
void resetData();
|
2017-05-04 04:53:29 +00:00
|
|
|
void removeCachedBody(int bodyUniqueId);
|
2019-08-08 08:53:23 +00:00
|
|
|
void clearCachedBodies();
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual void renderSceneInternal(){};
|
|
|
|
|
2015-09-25 05:50:34 +00:00
|
|
|
public:
|
2018-09-23 21:17:31 +00:00
|
|
|
PhysicsClientSharedMemory();
|
|
|
|
virtual ~PhysicsClientSharedMemory();
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
// return true if connection succesfull, can also check 'isConnected'
|
|
|
|
virtual bool connect();
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual void disconnectSharedMemory();
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual bool isConnected() const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
// return non-null if there is a status, nullptr otherwise
|
|
|
|
virtual const struct SharedMemoryStatus* processServerStatus();
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual struct SharedMemoryCommand* getAvailableSharedMemoryCommand();
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual bool canSubmitCommand() const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual bool submitClientCommand(const struct SharedMemoryCommand& command);
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2016-09-27 19:13:45 +00:00
|
|
|
virtual int getNumBodies() const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2016-09-27 19:13:45 +00:00
|
|
|
virtual int getBodyUniqueId(int serialIndex) const;
|
|
|
|
|
|
|
|
virtual bool getBodyInfo(int bodyUniqueId, struct b3BodyInfo& info) const;
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual int getNumJoints(int bodyUniqueId) const;
|
|
|
|
|
2019-03-26 22:07:55 +00:00
|
|
|
virtual int getNumDofs(int bodyUniqueId) const;
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual bool getJointInfo(int bodyUniqueId, int jointIndex, struct b3JointInfo& info) const;
|
|
|
|
|
|
|
|
virtual int getNumUserConstraints() const;
|
2016-09-27 19:13:45 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual int getUserConstraintInfo(int constraintUniqueId, struct b3UserConstraint& info) const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2017-05-04 01:25:25 +00:00
|
|
|
virtual int getUserConstraintId(int serialIndex) const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual void setSharedMemoryKey(int key);
|
|
|
|
|
|
|
|
virtual void uploadBulletFileToSharedMemory(const char* data, int len);
|
|
|
|
|
2018-06-16 15:14:00 +00:00
|
|
|
virtual void uploadRaysToSharedMemory(struct SharedMemoryCommand& command, const double* rayFromWorldArray, const double* rayToWorldArray, int numRays);
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual int getNumDebugLines() const;
|
2015-09-25 05:50:34 +00:00
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual const float* getDebugLinesFrom() const;
|
|
|
|
virtual const float* getDebugLinesTo() const;
|
|
|
|
virtual const float* getDebugLinesColor() const;
|
2016-05-31 17:23:04 +00:00
|
|
|
virtual void getCachedCameraImage(struct b3CameraImageData* cameraData);
|
2018-09-23 21:17:31 +00:00
|
|
|
|
2016-09-01 20:30:07 +00:00
|
|
|
virtual void getCachedContactPointInformation(struct b3ContactInformation* contactPointData);
|
2016-10-19 05:05:28 +00:00
|
|
|
|
2016-11-10 19:22:22 +00:00
|
|
|
virtual void getCachedOverlappingObjects(struct b3AABBOverlapData* overlappingObjects);
|
|
|
|
|
2016-10-19 05:05:28 +00:00
|
|
|
virtual void getCachedVisualShapeInformation(struct b3VisualShapeInformation* visualShapesInfo);
|
2016-12-27 03:40:09 +00:00
|
|
|
|
2018-01-04 03:17:28 +00:00
|
|
|
virtual void getCachedCollisionShapeInformation(struct b3CollisionShapeInformation* collisionShapesInfo);
|
|
|
|
|
2019-06-18 00:32:01 +00:00
|
|
|
virtual void getCachedMeshData(struct b3MeshData* meshData);
|
|
|
|
|
2016-12-27 03:40:09 +00:00
|
|
|
virtual void getCachedVREvents(struct b3VREventsData* vrEventsData);
|
|
|
|
|
2017-03-02 20:33:22 +00:00
|
|
|
virtual void getCachedKeyboardEvents(struct b3KeyboardEventsData* keyboardEventsData);
|
|
|
|
|
2017-06-17 20:29:14 +00:00
|
|
|
virtual void getCachedMouseEvents(struct b3MouseEventsData* mouseEventsData);
|
|
|
|
|
2016-12-27 03:40:09 +00:00
|
|
|
virtual void getCachedRaycastHits(struct b3RaycastInformation* raycastHits);
|
|
|
|
|
2017-10-05 15:23:10 +00:00
|
|
|
virtual void getCachedMassMatrix(int dofCountCheck, double* massMatrix);
|
|
|
|
|
2017-02-24 23:34:11 +00:00
|
|
|
virtual void setTimeOut(double timeOutInSeconds);
|
|
|
|
virtual double getTimeOut() const;
|
|
|
|
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual bool getCachedUserData(int userDataId, struct b3UserDataValue& valueOut) const;
|
|
|
|
virtual int getCachedUserDataId(int bodyUniqueId, int linkIndex, int visualShapeIndex, const char* key) const;
|
2018-07-03 15:45:19 +00:00
|
|
|
virtual int getNumUserData(int bodyUniqueId) const;
|
2018-09-23 21:17:31 +00:00
|
|
|
virtual void getUserDataInfo(int bodyUniqueId, int userDataIndex, const char** keyOut, int* userDataIdOut, int* linkIndexOut, int* visualShapeIndexOut) const;
|
2018-06-02 20:40:08 +00:00
|
|
|
|
2018-06-16 13:19:49 +00:00
|
|
|
virtual void pushProfileTiming(const char* timingName);
|
|
|
|
virtual void popProfileTiming();
|
2015-09-25 05:50:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // BT_PHYSICS_CLIENT_API_H
|