btInternalEdgeUtility.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef BT_INTERNAL_EDGE_UTILITY_H
  2. #define BT_INTERNAL_EDGE_UTILITY_H
  3. #include "LinearMath/btHashMap.h"
  4. #include "LinearMath/btVector3.h"
  5. #include "BulletCollision/CollisionShapes/btTriangleInfoMap.h"
  6. ///The btInternalEdgeUtility helps to avoid or reduce artifacts due to wrong collision normals caused by internal edges.
  7. ///See also http://code.google.com/p/bullet/issues/detail?id=27
  8. class btBvhTriangleMeshShape;
  9. class btCollisionObject;
  10. struct btCollisionObjectWrapper;
  11. class btManifoldPoint;
  12. class btIDebugDraw;
  13. class btHeightfieldTerrainShape;
  14. enum btInternalEdgeAdjustFlags
  15. {
  16. BT_TRIANGLE_CONVEX_BACKFACE_MODE = 1,
  17. BT_TRIANGLE_CONCAVE_DOUBLE_SIDED = 2, //double sided options are experimental, single sided is recommended
  18. BT_TRIANGLE_CONVEX_DOUBLE_SIDED = 4
  19. };
  20. ///Call btGenerateInternalEdgeInfo to create triangle info, store in the shape 'userInfo'
  21. void btGenerateInternalEdgeInfo(btBvhTriangleMeshShape* trimeshShape, btTriangleInfoMap* triangleInfoMap);
  22. void btGenerateInternalEdgeInfo(btHeightfieldTerrainShape* trimeshShape, btTriangleInfoMap* triangleInfoMap);
  23. ///Call the btFixMeshNormal to adjust the collision normal, using the triangle info map (generated using btGenerateInternalEdgeInfo)
  24. ///If this info map is missing, or the triangle is not store in this map, nothing will be done
  25. void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObjectWrapper* trimeshColObj0Wrap, const btCollisionObjectWrapper* otherColObj1Wrap, int partId0, int index0, int normalAdjustFlags = 0);
  26. ///Enable the BT_INTERNAL_EDGE_DEBUG_DRAW define and call btSetDebugDrawer, to get visual info to see if the internal edge utility works properly.
  27. ///If the utility doesn't work properly, you might have to adjust the threshold values in btTriangleInfoMap
  28. //#define BT_INTERNAL_EDGE_DEBUG_DRAW
  29. #ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
  30. void btSetDebugDrawer(btIDebugDraw* debugDrawer);
  31. #endif //BT_INTERNAL_EDGE_DEBUG_DRAW
  32. #endif //BT_INTERNAL_EDGE_UTILITY_H