export btHeightfieldTerrainShape to PyBullet. Note that tinyrenderer doesn't support rendering it (it would be too slow on CPU)

fix rare getKeyboardEvents threading issue
change texture color to default plane.urdf blue
This commit is contained in:
Erwin Coumans
2019-07-29 20:23:38 -07:00
parent 36f3adc03f
commit 51fba6f78d
14 changed files with 286 additions and 71 deletions

View File

@@ -15,6 +15,7 @@ subject to the following restrictions:
#include "btWorldImporter.h"
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h"
#ifdef USE_GIMPACT
#include "BulletCollision/Gimpact/btGImpactShape.h"
#endif
@@ -1784,6 +1785,19 @@ btMultiSphereShape* btWorldImporter::createMultiSphereShape(const btVector3* pos
return shape;
}
class btHeightfieldTerrainShape* btWorldImporter::createHeightfieldShape(int heightStickWidth, int heightStickLength,
const void* heightfieldData, btScalar heightScale,
btScalar minHeight, btScalar maxHeight,
int upAxis, int heightDataType,
bool flipQuadEdges)
{
btHeightfieldTerrainShape* shape = new btHeightfieldTerrainShape(heightStickWidth, heightStickLength,
heightfieldData, heightScale, minHeight, maxHeight, upAxis, PHY_ScalarType(heightDataType), flipQuadEdges);
m_allocatedCollisionShapes.push_back(shape);
return shape;
}
btRigidBody& btWorldImporter::getFixedBody()
{
static btRigidBody s_fixed(0, 0, 0);

View File

@@ -197,6 +197,12 @@ public:
virtual btTriangleIndexVertexArray* createMeshInterface(btStridingMeshInterfaceData& meshData);
virtual class btHeightfieldTerrainShape* createHeightfieldShape(int heightStickWidth, int heightStickLength,
const void* heightfieldData, btScalar heightScale,
btScalar minHeight, btScalar maxHeight,
int upAxis, int heightDataType,
bool flipQuadEdges);
///acceleration and connectivity structures
virtual btOptimizedBvh* createOptimizedBvh();
virtual btTriangleInfoMap* createTriangleInfoMap();