expose max_num_object_capacity and max_shape_capacity_in_bytes to override the graphics VBO buffer allocations. This allows to load larger triangle meshes in pybullet.

Example:
p.connect(p.GUI, options="--max_num_object_capacity=131072 --max_shape_capacity_in_bytes=1073741824")

Use MAX_NUM_PARTS_IN_BITS=4 by default, this allows to use 134 million triangles in each concave triangle mesh in PyBullet (instead of 2 Million)
This commit is contained in:
Erwin Coumans 2023-11-28 14:21:33 -08:00
parent 39b8de74df
commit fcef2c81f2
2 changed files with 18 additions and 2 deletions

View File

@ -885,6 +885,20 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
sUseOpenGL2 = args.CheckCmdLineFlag("opengl2");
args.GetCmdLineArgument("render_device", gRenderDevice);
args.GetCmdLineArgument("window_backend", gWindowBackend);
int max_num_object_capacity = 128 * 1024;
int max_shape_capacity_in_bytes = 128 * 1024 * 1024;
if (args.CheckCmdLineFlag("max_num_object_capacity"))
{
args.GetCmdLineArgument("max_num_object_capacity", max_num_object_capacity);
}
if (args.CheckCmdLineFlag("max_shape_capacity_in_bytes"))
{
args.GetCmdLineArgument("max_shape_capacity_in_bytes", max_shape_capacity_in_bytes);
}
#else
sUseOpenGL2 = true;
#endif
@ -914,7 +928,7 @@ bool OpenGLExampleBrowser::init(int argc, char* argv[])
{
char title[1024];
sprintf(title, "%s using OpenGL3+ %s %s", appTitle, glContext, optMode);
simpleApp = new SimpleOpenGL3App(title, width, height, gAllowRetina, gWindowBackend, gRenderDevice);
simpleApp = new SimpleOpenGL3App(title, width, height, gAllowRetina, gWindowBackend, gRenderDevice, max_num_object_capacity, max_shape_capacity_in_bytes);
s_app = simpleApp;
}
#endif

View File

@ -47,8 +47,10 @@ class btSerializer;
#define MAX_SUBTREE_SIZE_IN_BYTES 2048
// 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minus one
// 4 gives the potential for 16 parts, each with 2^27 triangles (134217728)
// actually) triangles each (since the sign bit is reserved
#define MAX_NUM_PARTS_IN_BITS 10
//#define MAX_NUM_PARTS_IN_BITS 10
#define MAX_NUM_PARTS_IN_BITS 4
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).