From d58a85fec4361cc96589000a6d1ec1fd7620485e Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 29 Jul 2019 20:29:07 -0700 Subject: [PATCH] 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 --- examples/Heightfield/HeightfieldExample.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/examples/Heightfield/HeightfieldExample.cpp b/examples/Heightfield/HeightfieldExample.cpp index 96d32c441..4f81c4ada 100644 --- a/examples/Heightfield/HeightfieldExample.cpp +++ b/examples/Heightfield/HeightfieldExample.cpp @@ -485,13 +485,16 @@ getRawHeightfieldData btAssert(raw && "out of memory"); byte_t * p = raw; - for (int i = 0; i < width; ++i) + + for (int j = 0; j < width; ++j) { - float x = i * s_gridSpacing; - for (int j = 0; j < width; ++j) + + for (int i = 0; i < width; ++i) { + float x = i * s_gridSpacing; float y = j * s_gridSpacing; - float z = double(image[i*3+width*j*3])*(14./256.); + float heightScaling = (14. / 256.); + float z = double(image[(width - 1 - i) * 3 + width*j * 3]) * heightScaling; convertFromFloat(p, z, type); // update min/max if (!i && !j) {