fixes in pybullet.loadTexture, changeVisualShape replacing texture.

(also works for OpenGL3 renderer now)
This commit is contained in:
Erwin Coumans
2017-06-30 13:35:07 -07:00
parent dcaaed9238
commit dd3d55610b
14 changed files with 275 additions and 76 deletions

View File

@@ -131,6 +131,8 @@ enum MultiThreadedGUIHelperCommunicationEnums
eGUIHelperChangeGraphicsInstanceRGBAColor,
eGUIHelperChangeGraphicsInstanceSpecularColor,
eGUIHelperSetVisualizerFlag,
eGUIHelperChangeGraphicsInstanceTextureId,
eGUIHelperGetShapeIndexFromInstance,
};
@@ -932,6 +934,29 @@ public:
m_cs->setSharedParam(1,eGUIHelperRemoveGraphicsInstance);
workerThreadWait();
}
int m_getShapeIndex_instance;
int getShapeIndex_shapeIndex;
virtual int getShapeIndexFromInstance(int instance)
{
m_getShapeIndex_instance = instance;
m_cs->lock();
m_cs->setSharedParam(1,eGUIHelperGetShapeIndexFromInstance);
workerThreadWait();
return getShapeIndex_shapeIndex;
}
int m_graphicsInstanceChangeTextureId;
int m_graphicsInstanceChangeTextureShapeIndex;
virtual void replaceTexture(int shapeIndex, int textureUid)
{
m_graphicsInstanceChangeTextureShapeIndex = shapeIndex;
m_graphicsInstanceChangeTextureId = textureUid;
m_cs->lock();
m_cs->setSharedParam(1,eGUIHelperChangeGraphicsInstanceTextureId);
workerThreadWait();
}
double m_rgbaColor[4];
int m_graphicsInstanceChangeColor;
@@ -1913,6 +1938,24 @@ void PhysicsServerExample::updateGraphics()
break;
}
case eGUIHelperGetShapeIndexFromInstance:
{
m_multiThreadedHelper->getShapeIndex_shapeIndex = m_multiThreadedHelper->m_childGuiHelper->getShapeIndexFromInstance(m_multiThreadedHelper->m_getShapeIndex_instance);
m_multiThreadedHelper->mainThreadRelease();
break;
}
case eGUIHelperChangeGraphicsInstanceTextureId:
{
m_multiThreadedHelper->m_childGuiHelper->replaceTexture(
m_multiThreadedHelper->m_graphicsInstanceChangeTextureShapeIndex,
m_multiThreadedHelper->m_graphicsInstanceChangeTextureId);
m_multiThreadedHelper->mainThreadRelease();
break;
}
case eGUIHelperChangeGraphicsInstanceRGBAColor:
{
m_multiThreadedHelper->m_childGuiHelper->changeRGBAColor(m_multiThreadedHelper->m_graphicsInstanceChangeColor,m_multiThreadedHelper->m_rgbaColor);