Merge pull request #1361 from erwincoumans/master
fix some compile issues/bugs
This commit is contained in:
@@ -206,19 +206,6 @@ void PhysicsClientSharedMemory::removeCachedBody(int bodyUniqueId)
|
|||||||
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId];
|
BodyJointInfoCache** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId];
|
||||||
if (bodyJointsPtr && *bodyJointsPtr)
|
if (bodyJointsPtr && *bodyJointsPtr)
|
||||||
{
|
{
|
||||||
|
|
||||||
BodyJointInfoCache* bodyJoints = *bodyJointsPtr;
|
|
||||||
for (int j=0;j<bodyJoints->m_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);
|
delete (*bodyJointsPtr);
|
||||||
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1036,17 +1036,6 @@ void PhysicsDirect::removeCachedBody(int bodyUniqueId)
|
|||||||
BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId];
|
BodyJointInfoCache2** bodyJointsPtr = m_data->m_bodyJointMap[bodyUniqueId];
|
||||||
if (bodyJointsPtr && *bodyJointsPtr)
|
if (bodyJointsPtr && *bodyJointsPtr)
|
||||||
{
|
{
|
||||||
BodyJointInfoCache2* bodyJoints = *bodyJointsPtr;
|
|
||||||
for (int j=0;j<bodyJoints->m_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);
|
delete (*bodyJointsPtr);
|
||||||
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
m_data->m_bodyJointMap.remove(bodyUniqueId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1329,8 +1329,8 @@ public:
|
|||||||
|
|
||||||
btVector3 getRayTo(int x,int y);
|
btVector3 getRayTo(int x,int y);
|
||||||
|
|
||||||
virtual void vrControllerButtonCallback(int controllerId, int button, int state, float pos[4], float orientation[4]);
|
virtual void vrControllerButtonCallback(int controllerId, int button, int state, float pos[4], float orn[4]);
|
||||||
virtual void vrControllerMoveCallback(int controllerId, float pos[4], float orientation[4], float analogAxis, float auxAnalogAxes[10]);
|
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 vrHMDMoveCallback(int controllerId, float pos[4], float orientation[4]);
|
||||||
virtual void vrGenericTrackerMoveCallback(int controllerId, float pos[4], float orientation[4]);
|
virtual void vrGenericTrackerMoveCallback(int controllerId, float pos[4], float orientation[4]);
|
||||||
|
|
||||||
|
|||||||
@@ -1097,45 +1097,31 @@ void TinyRendererVisualShapeConverter::resetAll()
|
|||||||
m_data->m_visualShapes.clear();
|
m_data->m_visualShapes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TinyRendererVisualShapeConverter::activateShapeTexture(int shapeUniqueId, int textureUniqueId)
|
|
||||||
|
void TinyRendererVisualShapeConverter::activateShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId)
|
||||||
{
|
{
|
||||||
btAssert(textureUniqueId < m_data->m_textures.size());
|
btAssert(textureUniqueId < m_data->m_textures.size());
|
||||||
if (textureUniqueId >= 0 && textureUniqueId < m_data->m_textures.size())
|
if (textureUniqueId >= 0 && textureUniqueId < m_data->m_textures.size())
|
||||||
{
|
{
|
||||||
TinyRendererObjectArray** ptrptr = m_data->m_swRenderInstances.getAtIndex(shapeUniqueId);
|
for (int n = 0; n < m_data->m_swRenderInstances.size(); n++)
|
||||||
if (ptrptr && *ptrptr)
|
|
||||||
{
|
{
|
||||||
TinyRendererObjectArray* ptr = *ptrptr;
|
TinyRendererObjectArray** visualArrayPtr = m_data->m_swRenderInstances.getAtIndex(n);
|
||||||
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);
|
if (0 == visualArrayPtr)
|
||||||
|
continue;//can this ever happen?
|
||||||
|
TinyRendererObjectArray* visualArray = *visualArrayPtr;
|
||||||
|
|
||||||
|
if (visualArray->m_objectUniqueId == objectUniqueId && visualArray->m_linkIndex == jointIndex)
|
||||||
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
if (start >= 0)
|
|
||||||
{
|
|
||||||
if (start + shapeIndex < m_data->m_visualShapes.size())
|
|
||||||
{
|
|
||||||
activateShapeTexture(start + shapeIndex, textureUniqueId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ struct TinyRendererVisualShapeConverter : public LinkVisualShapesConverter
|
|||||||
|
|
||||||
int loadTextureFile(const char* filename);
|
int loadTextureFile(const char* filename);
|
||||||
int registerTexture(unsigned char* texels, int width, int height);
|
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);
|
void activateShapeTexture(int objectUniqueId, int jointIndex, int shapeIndex, int textureUniqueId);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2902,7 +2902,7 @@ static PyObject* pybullet_getJointInfo(PyObject* self, PyObject* args, PyObject*
|
|||||||
// info.m_jointFriction);
|
// info.m_jointFriction);
|
||||||
PyTuple_SetItem(pyListJointInfo, 0, PyInt_FromLong(info.m_jointIndex));
|
PyTuple_SetItem(pyListJointInfo, 0, PyInt_FromLong(info.m_jointIndex));
|
||||||
|
|
||||||
if (info.m_jointName)
|
if (info.m_jointName[0])
|
||||||
{
|
{
|
||||||
PyTuple_SetItem(pyListJointInfo, 1,
|
PyTuple_SetItem(pyListJointInfo, 1,
|
||||||
PyString_FromString(info.m_jointName));
|
PyString_FromString(info.m_jointName));
|
||||||
@@ -2928,7 +2928,7 @@ static PyObject* pybullet_getJointInfo(PyObject* self, PyObject* args, PyObject*
|
|||||||
PyFloat_FromDouble(info.m_jointMaxForce));
|
PyFloat_FromDouble(info.m_jointMaxForce));
|
||||||
PyTuple_SetItem(pyListJointInfo, 11,
|
PyTuple_SetItem(pyListJointInfo, 11,
|
||||||
PyFloat_FromDouble(info.m_jointMaxVelocity));
|
PyFloat_FromDouble(info.m_jointMaxVelocity));
|
||||||
if (info.m_linkName)
|
if (info.m_linkName[0])
|
||||||
{
|
{
|
||||||
|
|
||||||
PyTuple_SetItem(pyListJointInfo, 12,
|
PyTuple_SetItem(pyListJointInfo, 12,
|
||||||
|
|||||||
Reference in New Issue
Block a user