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