code-google-com / bullet

Automatically exported from code.google.com/p/bullet
0 stars 0 forks source link

proposed btBvhTriangleMeshShape::buildOptimizedBvh() for greater flexibility #340

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This is not an issue, it is an enhancement request.

I suggest to provide a function that allows to build the BVH independently
of the scaling. This has couple of advantages:
- the user can decide to build the BVH at a later time if he didn't do it
in the constructor.
- avoids code duplication.

The reason why I need this is for an optimization I have implemented in
Blender where I create a shared btBvhTriangleMeshShape object for physics
objects that share the same mesh. This sharing is applicable to soft bodies
(which don't use the btBvhTriangleMeshShape directly, only the mesh
interface and therefore don't need the BVH structure) and rigid and static
bodies (which use the BVH). 

So if the mesh is first converted to a soft body, the
btBvhTriangleMeshShape shared object is created without BVH to save
computation, and if later the same mesh is reused to create a rigid or
static body, the BVH is constructed using the new function.

The attached file contains the patch.

This patch doesn't break anything, I hope it can be accepted. 

Original issue reported on code.google.com by benoitbo...@gmail.com on 3 Feb 2010 at 10:02

Attachments:

GoogleCodeExporter commented 9 years ago

Hi Benoit,

Looks good, it has been applied.

By the way, Bullet 2.76 is nearing completion (this week hopefully) and I would 
like 
to see Blender 2.5 trunk upgrading to 2.76.

Do you want to help with that, or should I do the upgrade?
Thanks!
Erwin

Original comment by erwin.coumans on 3 Feb 2010 at 4:17

GoogleCodeExporter commented 9 years ago
Thanks for applying the patch so quickly. I can now release my optimization in
Blender :-)

 I will be happy to help with the integration of Bullet 2.76 in Blender. I have a
contract that allows me to get paid for such kind of work, it always helps for 
the
motivation :-)

Original comment by benoitbo...@gmail.com on 3 Feb 2010 at 8:41

GoogleCodeExporter commented 9 years ago

Original comment by erwin.coumans on 12 Feb 2010 at 12:51