PyBullet: allow to update an existing heightfield shape
Also, use flags = p.GEOM_CONCAVE_INTERNAL_EDGE to enable internal edge filtering for heightfield (disabled by default) See https://github.com/bulletphysics/bullet3/blob/master/examples/pybullet/examples/heightfield.py
This commit is contained in:
@@ -127,6 +127,7 @@ enum MultiThreadedGUIHelperCommunicationEnums
|
||||
eGUIHelperChangeTexture,
|
||||
eGUIHelperRemoveTexture,
|
||||
eGUIHelperSetVisualizerFlagCheckRenderedFrame,
|
||||
eGUIHelperUpdateShape,
|
||||
};
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -865,6 +866,18 @@ public:
|
||||
workerThreadWait();
|
||||
}
|
||||
|
||||
int m_updateShapeIndex;
|
||||
float* m_updateShapeVertices;
|
||||
|
||||
virtual void updateShape(int shapeIndex, float* vertices)
|
||||
{
|
||||
m_updateShapeIndex = shapeIndex;
|
||||
m_updateShapeVertices = vertices;
|
||||
|
||||
m_cs->lock();
|
||||
m_cs->setSharedParam(1, eGUIHelperUpdateShape);
|
||||
workerThreadWait();
|
||||
}
|
||||
virtual int registerTexture(const unsigned char* texels, int width, int height)
|
||||
{
|
||||
int* cachedTexture = m_cachedTextureIds[texels];
|
||||
@@ -1916,6 +1929,15 @@ void PhysicsServerExample::updateGraphics()
|
||||
m_multiThreadedHelper->mainThreadRelease();
|
||||
break;
|
||||
}
|
||||
|
||||
case eGUIHelperUpdateShape:
|
||||
{
|
||||
B3_PROFILE("eGUIHelperUpdateShape");
|
||||
m_multiThreadedHelper->m_childGuiHelper->updateShape(m_multiThreadedHelper->m_updateShapeIndex, m_multiThreadedHelper->m_updateShapeVertices);
|
||||
m_multiThreadedHelper->mainThreadRelease();
|
||||
break;
|
||||
}
|
||||
|
||||
case eGUIHelperRegisterGraphicsShape:
|
||||
{
|
||||
B3_PROFILE("eGUIHelperRegisterGraphicsShape");
|
||||
@@ -2039,6 +2061,7 @@ void PhysicsServerExample::updateGraphics()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case eGUIHelperSetVisualizerFlagCheckRenderedFrame:
|
||||
{
|
||||
if (m_renderedFrames != m_multiThreadedHelper->m_renderedFrames)
|
||||
|
||||
Reference in New Issue
Block a user