00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef BT_SOFT_BODY_HELPERS_H
00017 #define BT_SOFT_BODY_HELPERS_H
00018
00019 #include "btSoftBody.h"
00020
00021
00022
00023
00024
00025
00026 struct fDrawFlags { enum _ {
00027 Nodes = 0x0001,
00028 Links = 0x0002,
00029 Faces = 0x0004,
00030 Tetras = 0x0008,
00031 Normals = 0x0010,
00032 Contacts = 0x0020,
00033 Anchors = 0x0040,
00034 Notes = 0x0080,
00035 Clusters = 0x0100,
00036 NodeTree = 0x0200,
00037 FaceTree = 0x0400,
00038 ClusterTree = 0x0800,
00039 Joints = 0x1000,
00040
00041 Std = Links+Faces+Tetras+Anchors+Notes+Joints,
00042 StdTetra = Std-Faces+Tetras
00043 };};
00044
00045 struct btSoftBodyHelpers
00046 {
00047
00048 static void Draw( btSoftBody* psb,
00049 btIDebugDraw* idraw,
00050 int drawflags=fDrawFlags::Std);
00051
00052 static void DrawInfos( btSoftBody* psb,
00053 btIDebugDraw* idraw,
00054 bool masses,
00055 bool areas,
00056 bool stress);
00057
00058 static void DrawNodeTree( btSoftBody* psb,
00059 btIDebugDraw* idraw,
00060 int mindepth=0,
00061 int maxdepth=-1);
00062
00063 static void DrawFaceTree( btSoftBody* psb,
00064 btIDebugDraw* idraw,
00065 int mindepth=0,
00066 int maxdepth=-1);
00067
00068 static void DrawClusterTree(btSoftBody* psb,
00069 btIDebugDraw* idraw,
00070 int mindepth=0,
00071 int maxdepth=-1);
00072
00073 static void DrawFrame( btSoftBody* psb,
00074 btIDebugDraw* idraw);
00075
00076 static btSoftBody* CreateRope( btSoftBodyWorldInfo& worldInfo,
00077 const btVector3& from,
00078 const btVector3& to,
00079 int res,
00080 int fixeds);
00081
00082 static btSoftBody* CreatePatch(btSoftBodyWorldInfo& worldInfo,
00083 const btVector3& corner00,
00084 const btVector3& corner10,
00085 const btVector3& corner01,
00086 const btVector3& corner11,
00087 int resx,
00088 int resy,
00089 int fixeds,
00090 bool gendiags);
00091
00092 static btSoftBody* CreatePatchUV(btSoftBodyWorldInfo& worldInfo,
00093 const btVector3& corner00,
00094 const btVector3& corner10,
00095 const btVector3& corner01,
00096 const btVector3& corner11,
00097 int resx,
00098 int resy,
00099 int fixeds,
00100 bool gendiags,
00101 float* tex_coords=0);
00102 static float CalculateUV(int resx,int resy,int ix,int iy,int id);
00103
00104 static btSoftBody* CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,
00105 const btVector3& center,
00106 const btVector3& radius,
00107 int res);
00108
00109 static btSoftBody* CreateFromTriMesh( btSoftBodyWorldInfo& worldInfo,
00110 const btScalar* vertices,
00111 const int* triangles,
00112 int ntriangles,
00113 bool randomizeConstraints = true);
00114
00115 static btSoftBody* CreateFromConvexHull( btSoftBodyWorldInfo& worldInfo,
00116 const btVector3* vertices,
00117 int nvertices,
00118 bool randomizeConstraints = true);
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 static btSoftBody* CreateFromTetGenData( btSoftBodyWorldInfo& worldInfo,
00134 const char* ele,
00135 const char* face,
00136 const char* node,
00137 bool bfacelinks,
00138 bool btetralinks,
00139 bool bfacesfromtetras);
00140
00141 };
00142
00143 #endif //BT_SOFT_BODY_HELPERS_H