btInternalEdgeUtility.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef BT_INTERNAL_EDGE_UTILITY_H
  2. #define BT_INTERNAL_EDGE_UTILITY_H
  3. #include "bullet/LinearMath/btHashMap.h"
  4. #include "bullet/LinearMath/btVector3.h"
  5. #include "bullet/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. enum btInternalEdgeAdjustFlags
  14. {
  15. BT_TRIANGLE_CONVEX_BACKFACE_MODE = 1,
  16. BT_TRIANGLE_CONCAVE_DOUBLE_SIDED = 2, //double sided options are experimental, single sided is recommended
  17. BT_TRIANGLE_CONVEX_DOUBLE_SIDED = 4
  18. };
  19. ///Call btGenerateInternalEdgeInfo to create triangle info, store in the shape 'userInfo'
  20. void btGenerateInternalEdgeInfo (btBvhTriangleMeshShape*trimeshShape, btTriangleInfoMap* triangleInfoMap);
  21. ///Call the btFixMeshNormal to adjust the collision normal, using the triangle info map (generated using btGenerateInternalEdgeInfo)
  22. ///If this info map is missing, or the triangle is not store in this map, nothing will be done
  23. void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObjectWrapper* trimeshColObj0Wrap,const btCollisionObjectWrapper* otherColObj1Wrap, int partId0, int index0, int normalAdjustFlags = 0);
  24. ///Enable the BT_INTERNAL_EDGE_DEBUG_DRAW define and call btSetDebugDrawer, to get visual info to see if the internal edge utility works properly.
  25. ///If the utility doesn't work properly, you might have to adjust the threshold values in btTriangleInfoMap
  26. //#define BT_INTERNAL_EDGE_DEBUG_DRAW
  27. #ifdef BT_INTERNAL_EDGE_DEBUG_DRAW
  28. void btSetDebugDrawer(btIDebugDraw* debugDrawer);
  29. #endif //BT_INTERNAL_EDGE_DEBUG_DRAW
  30. #endif //BT_INTERNAL_EDGE_UTILITY_H