diff --git a/examples/SharedMemory/PhysicsClientSharedMemory.cpp b/examples/SharedMemory/PhysicsClientSharedMemory.cpp index 050a9a257..20eaf0ad5 100644 --- a/examples/SharedMemory/PhysicsClientSharedMemory.cpp +++ b/examples/SharedMemory/PhysicsClientSharedMemory.cpp @@ -206,19 +206,6 @@ void PhysicsClientSharedMemory::removeCachedBody(int bodyUniqueId) BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; if (bodyJointsPtr && *bodyJointsPtr) { - - BodyJointInfoCache* bodyJoints = *bodyJointsPtr; - for (int j=0;jm_jointInfo.size();j++) - { - if (bodyJoints->m_jointInfo[j].m_jointName) - { - free(bodyJoints->m_jointInfo[j].m_jointName); - } - if (bodyJoints->m_jointInfo[j].m_linkName) - { - free(bodyJoints->m_jointInfo[j].m_linkName); - } - } delete (*bodyJointsPtr); m_data->m_bodyJointMap.remove(bodyUniqueId); } diff --git a/examples/SharedMemory/PhysicsDirect.cpp b/examples/SharedMemory/PhysicsDirect.cpp index 94922ff0d..9ad84404e 100644 --- a/examples/SharedMemory/PhysicsDirect.cpp +++ b/examples/SharedMemory/PhysicsDirect.cpp @@ -1036,17 +1036,6 @@ void PhysicsDirect::removeCachedBody(int bodyUniqueId) BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId]; if (bodyJointsPtr && *bodyJointsPtr) { - BodyJointInfoCache2* bodyJoints = *bodyJointsPtr; - for (int j=0;jm_jointInfo.size();j++) { - if (bodyJoints->m_jointInfo[j].m_jointName) - { - free(bodyJoints->m_jointInfo[j].m_jointName); - } - if (bodyJoints->m_jointInfo[j].m_linkName) - { - free(bodyJoints->m_jointInfo[j].m_linkName); - } - } delete (*bodyJointsPtr); m_data->m_bodyJointMap.remove(bodyUniqueId); } diff --git a/examples/SharedMemory/PhysicsServerExample.cpp b/examples/SharedMemory/PhysicsServerExample.cpp index 85da43d4e..290192139 100644 --- a/examples/SharedMemory/PhysicsServerExample.cpp +++ b/examples/SharedMemory/PhysicsServerExample.cpp @@ -1329,8 +1329,8 @@ public: btVector3 getRayTo(int x,int y); - virtual void vrControllerButtonCallback(int controllerId, int button, int state, float pos[4], float orientation[4]); - virtual void vrControllerMoveCallback(int controllerId, float pos[4], float orientation[4], float analogAxis, float auxAnalogAxes[10]); + virtual void vrControllerButtonCallback(int controllerId, int button, int state, float pos[4], float orn[4]); + virtual void vrControllerMoveCallback(int controllerId, float pos[4], float orn[4], float analogAxis, float auxAnalogAxes[10]); virtual void vrHMDMoveCallback(int controllerId, float pos[4], float orientation[4]); virtual void vrGenericTrackerMoveCallback(int controllerId, float pos[4], float orientation[4]); diff --git a/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp b/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp index 795ba10bd..b72f9ce82 100644 --- a/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp +++ b/examples/SharedMemory/TinyRendererVisualShapeConverter.cpp @@ -1097,45 +1097,31 @@ void TinyRendererVisualShapeConverter::resetAll() m_data->m_visualShapes.clear(); } -void TinyRendererVisualShapeConverter::activateShapeTexture(int shapeUniqueId, int textureUniqueId) -{ - btAssert(textureUniqueId < m_data->m_textures.size()); - if (textureUniqueId>=0 && textureUniqueIdm_textures.size()) - { - TinyRendererObjectArray** ptrptr = m_data->m_swRenderInstances.getAtIndex(shapeUniqueId); - if (ptrptr && *ptrptr) - { - TinyRendererObjectArray* ptr = *ptrptr; - ptr->m_renderObjects[0]->m_model->setDiffuseTextureFromData(m_data->m_textures[textureUniqueId].textureData,m_data->m_textures[textureUniqueId].m_width,m_data->m_textures[textureUniqueId].m_height); - } - } -} void TinyRendererVisualShapeConverter::activateShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId) { - int start = -1; - for (int i = 0; i < m_data->m_visualShapes.size(); i++) - { - if (m_data->m_visualShapes[i].m_objectUniqueId == objectUniqueId && m_data->m_visualShapes[i].m_linkIndex == jointIndex) - { - if (shapeIndex<0) - { - activateShapeTexture(i, textureUniqueId); - } else - { - start = i; - break; - } - } - } - if (shapeIndex>=0) + btAssert(textureUniqueId < m_data->m_textures.size()); + if (textureUniqueId >= 0 && textureUniqueId < m_data->m_textures.size()) { - if (start >= 0) + for (int n = 0; n < m_data->m_swRenderInstances.size(); n++) { - if (start + shapeIndex < m_data->m_visualShapes.size()) + TinyRendererObjectArray** visualArrayPtr = m_data->m_swRenderInstances.getAtIndex(n); + if (0 == visualArrayPtr) + continue;//can this ever happen? + TinyRendererObjectArray* visualArray = *visualArrayPtr; + + if (visualArray->m_objectUniqueId == objectUniqueId && visualArray->m_linkIndex == jointIndex) { - activateShapeTexture(start + shapeIndex, textureUniqueId); + for (int v = 0; v < visualArray->m_renderObjects.size(); v++) + { + TinyRenderObjectData* renderObj = visualArray->m_renderObjects[v]; + if ((shapeIndex < 0) || (shapeIndex == v)) + { + renderObj->m_model->setDiffuseTextureFromData(m_data->m_textures[textureUniqueId].textureData, m_data->m_textures[textureUniqueId].m_width, m_data->m_textures[textureUniqueId].m_height); + } + } } + } } } diff --git a/examples/SharedMemory/TinyRendererVisualShapeConverter.h b/examples/SharedMemory/TinyRendererVisualShapeConverter.h index acc036229..97bbb0a36 100644 --- a/examples/SharedMemory/TinyRendererVisualShapeConverter.h +++ b/examples/SharedMemory/TinyRendererVisualShapeConverter.h @@ -51,7 +51,7 @@ struct TinyRendererVisualShapeConverter : public LinkVisualShapesConverter int loadTextureFile(const char* filename); int registerTexture(unsigned char* texels, int width, int height); - void activateShapeTexture(int shapeUniqueId, int textureUniqueId); + void activateShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId); }; diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c index af6f463b0..4032fcb69 100644 --- a/examples/pybullet/pybullet.c +++ b/examples/pybullet/pybullet.c @@ -2902,7 +2902,7 @@ static PyObject* pybullet_getJointInfo(PyObject* self, PyObject* args, PyObject* // info.m_jointFriction); PyTuple_SetItem(pyListJointInfo, 0, PyInt_FromLong(info.m_jointIndex)); - if (info.m_jointName) + if (info.m_jointName[0]) { PyTuple_SetItem(pyListJointInfo, 1, PyString_FromString(info.m_jointName)); @@ -2928,7 +2928,7 @@ static PyObject* pybullet_getJointInfo(PyObject* self, PyObject* args, PyObject* PyFloat_FromDouble(info.m_jointMaxForce)); PyTuple_SetItem(pyListJointInfo, 11, PyFloat_FromDouble(info.m_jointMaxVelocity)); - if (info.m_linkName) + if (info.m_linkName[0]) { PyTuple_SetItem(pyListJointInfo, 12,