2
Bullet Continuous Collision Detection and Physics Library
3
Copyright (c) 2003-2008 Erwin Coumans http://continuousphysics.com/Bullet/
5
This software is provided 'as-is', without any express or implied warranty.
6
In no event will the authors be held liable for any damages arising from the use of this software.
7
Permission is granted to anyone to use this software for any purpose,
8
including commercial applications, and to alter it and redistribute it freely,
9
subject to the following restrictions:
11
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13
3. This notice may not be removed or altered from any source distribution.
16
#ifndef BT_SOFT_BODY_HELPERS_H
17
#define BT_SOFT_BODY_HELPERS_H
19
#include "btSoftBody.h"
26
struct fDrawFlags { enum _ {
41
Std = Links+Faces+Tetras+Anchors+Notes+Joints,
42
StdTetra = Std-Faces+Tetras
45
struct btSoftBodyHelpers
48
static void Draw( btSoftBody* psb,
50
int drawflags=fDrawFlags::Std);
52
static void DrawInfos( btSoftBody* psb,
58
static void DrawNodeTree( btSoftBody* psb,
63
static void DrawFaceTree( btSoftBody* psb,
67
/* Draw cluster tree */
68
static void DrawClusterTree(btSoftBody* psb,
72
/* Draw rigid frame */
73
static void DrawFrame( btSoftBody* psb,
76
static btSoftBody* CreateRope( btSoftBodyWorldInfo& worldInfo,
77
const btVector3& from,
82
static btSoftBody* CreatePatch(btSoftBodyWorldInfo& worldInfo,
83
const btVector3& corner00,
84
const btVector3& corner10,
85
const btVector3& corner01,
86
const btVector3& corner11,
91
/* Create a patch with UV Texture Coordinates */
92
static btSoftBody* CreatePatchUV(btSoftBodyWorldInfo& worldInfo,
93
const btVector3& corner00,
94
const btVector3& corner10,
95
const btVector3& corner01,
96
const btVector3& corner11,
101
float* tex_coords=0);
102
static float CalculateUV(int resx,int resy,int ix,int iy,int id);
103
/* Create an ellipsoid */
104
static btSoftBody* CreateEllipsoid(btSoftBodyWorldInfo& worldInfo,
105
const btVector3& center,
106
const btVector3& radius,
108
/* Create from trimesh */
109
static btSoftBody* CreateFromTriMesh( btSoftBodyWorldInfo& worldInfo,
110
const btScalar* vertices,
111
const int* triangles,
113
bool randomizeConstraints = true);
114
/* Create from convex-hull */
115
static btSoftBody* CreateFromConvexHull( btSoftBodyWorldInfo& worldInfo,
116
const btVector3* vertices,
118
bool randomizeConstraints = true);
121
/* Export TetGen compatible .smesh file */
122
// static void ExportAsSMeshFile( btSoftBody* psb,
123
// const char* filename);
124
/* Create from TetGen .ele, .face, .node files */
125
// static btSoftBody* CreateFromTetGenFile( btSoftBodyWorldInfo& worldInfo,
131
// bool bfacesfromtetras);
132
/* Create from TetGen .ele, .face, .node data */
133
static btSoftBody* CreateFromTetGenData( btSoftBodyWorldInfo& worldInfo,
139
bool bfacesfromtetras);
143
#endif //BT_SOFT_BODY_HELPERS_H