Thanks for taking a look, and I'm glad it makes sense.
- All good points, and my mistake throughout. I somehow got out of the habit of using btMaterial objects at all, but I've changed both the btMultimaterialTriangleMeshShape and the demo file to include them more thoroughly. I also split the btMaterial definition into its own file. Take a look and let me know what you think.
- Currently, I am using the material index method you describe. The btMultimaterialTriangleMeshShape contains a list of the materials (m_materialList), and a list of indices (m_triangleMaterials). If you look at the implementation for btMultimaterialTriangleMeshShape::getMaterialProperties, the last three lines of code (1) obtain the index into the list of indices by using the partID and triIndex arguments, (2) obtain the pointer to the material data in the material list, and (3) return it. If you wanted to trim it down even more though, the scheme could be altered to make use of the partID. This is something Erwin suggested earlier in this thread, but I never got around to doing. Currently, the list of indices into the material array is on a per triangle basis, but this could be changed to be on a per part basis. The mesh could be divided by which parts based on which triangle use which materials. The mesh shape could be created, then part 1 (which uses material 1) could be added, followed by part 2 (which uses material 2) and so on. That way, rather than each triangle holding an index into the material array, each part would. This would have presented some additional problems for the project for which this package was written, just in the way we're representing our mesh data, but it's definitely something I'd like to come back to when/if time allows.
- Alex