From 2d224cf3197a05f463f0d8de96e582af9aa37ce6 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sat, 20 Oct 2018 19:44:39 -0700 Subject: [PATCH] revert backward compabitility in API --- examples/SharedMemory/PhysicsClientC_API.cpp | 23 ++++++++++++++++++- examples/SharedMemory/PhysicsClientC_API.h | 3 ++- .../SharedMemory/PhysicsClientExample.cpp | 2 +- .../b3RobotSimulatorClientAPI_NoDirect.cpp | 2 +- examples/pybullet/pybullet.c | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/examples/SharedMemory/PhysicsClientC_API.cpp b/examples/SharedMemory/PhysicsClientC_API.cpp index 84c287900..ad356d671 100644 --- a/examples/SharedMemory/PhysicsClientC_API.cpp +++ b/examples/SharedMemory/PhysicsClientC_API.cpp @@ -4008,7 +4008,28 @@ B3_SHARED_API int b3GetStatusTextureUniqueId(b3SharedMemoryStatusHandle statusHa return uid; } -B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex) +B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex, int textureUniqueId) +{ + PhysicsClient* cl = (PhysicsClient*)physClient; + b3Assert(cl); + b3Assert(cl->canSubmitCommand()); + struct SharedMemoryCommand* command = cl->getAvailableSharedMemoryCommand(); + b3Assert(command); + command->m_type = CMD_UPDATE_VISUAL_SHAPE; + command->m_updateVisualShapeDataArguments.m_bodyUniqueId = bodyUniqueId; + command->m_updateVisualShapeDataArguments.m_jointIndex = jointIndex; + command->m_updateVisualShapeDataArguments.m_shapeIndex = shapeIndex; + command->m_updateVisualShapeDataArguments.m_textureUniqueId = textureUniqueId; + command->m_updateFlags = 0; + + if (textureUniqueId >= 0) + { + command->m_updateFlags |= CMD_UPDATE_VISUAL_SHAPE_TEXTURE; + } + return (b3SharedMemoryCommandHandle)command; +} + +B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape2(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex) { PhysicsClient* cl = (PhysicsClient*)physClient; b3Assert(cl); diff --git a/examples/SharedMemory/PhysicsClientC_API.h b/examples/SharedMemory/PhysicsClientC_API.h index 5350eedb9..b50489b29 100644 --- a/examples/SharedMemory/PhysicsClientC_API.h +++ b/examples/SharedMemory/PhysicsClientC_API.h @@ -308,7 +308,8 @@ extern "C" B3_SHARED_API b3SharedMemoryCommandHandle b3CreateChangeTextureCommandInit(b3PhysicsClientHandle physClient, int textureUniqueId, int width, int height, const char* rgbPixels); - B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex); + B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex, int textureUniqueId); + B3_SHARED_API b3SharedMemoryCommandHandle b3InitUpdateVisualShape2(b3PhysicsClientHandle physClient, int bodyUniqueId, int jointIndex, int shapeIndex); B3_SHARED_API void b3UpdateVisualShapeTexture(b3SharedMemoryCommandHandle commandHandle, int textureUniqueId); B3_SHARED_API void b3UpdateVisualShapeRGBAColor(b3SharedMemoryCommandHandle commandHandle, const double rgbaColor[/*4*/]); B3_SHARED_API void b3UpdateVisualShapeSpecularColor(b3SharedMemoryCommandHandle commandHandle, const double specularColor[/*3*/]); diff --git a/examples/SharedMemory/PhysicsClientExample.cpp b/examples/SharedMemory/PhysicsClientExample.cpp index 268ba4363..f1f46f951 100644 --- a/examples/SharedMemory/PhysicsClientExample.cpp +++ b/examples/SharedMemory/PhysicsClientExample.cpp @@ -497,7 +497,7 @@ void PhysicsClientExample::prepareAndSubmitCommand(int commandId) int shapeIndex = -1; int textureIndex = -2; double rgbaColor[4] = {0.0, 1.0, 0.0, 1.0}; - b3SharedMemoryCommandHandle commandHandle = b3InitUpdateVisualShape(m_physicsClientHandle, objectUniqueId, linkIndex, shapeIndex); + b3SharedMemoryCommandHandle commandHandle = b3InitUpdateVisualShape2(m_physicsClientHandle, objectUniqueId, linkIndex, shapeIndex); b3UpdateVisualShapeRGBAColor(commandHandle, rgbaColor); b3SubmitClientCommand(m_physicsClientHandle, commandHandle); break; diff --git a/examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp b/examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp index 033ee9c6b..f04d43f18 100644 --- a/examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp +++ b/examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp @@ -190,7 +190,7 @@ bool b3RobotSimulatorClientAPI_NoDirect::changeVisualShape(const struct b3RobotS b3SharedMemoryStatusHandle statusHandle; int statusType; - commandHandle = b3InitUpdateVisualShape(m_data->m_physicsClientHandle, objectUniqueId, jointIndex, shapeIndex); + commandHandle = b3InitUpdateVisualShape2(m_data->m_physicsClientHandle, objectUniqueId, jointIndex, shapeIndex); if (textureUniqueId>=-1) { diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index 9bfbbc66c..e44a5c350 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -5606,7 +5606,7 @@ static PyObject* pybullet_changeVisualShape(PyObject* self, PyObject* args, PyOb } { - commandHandle = b3InitUpdateVisualShape(sm, objectUniqueId, jointIndex, shapeIndex); + commandHandle = b3InitUpdateVisualShape2(sm, objectUniqueId, jointIndex, shapeIndex); if (textureUniqueId>=-1) {