Bullet Collision Detection & Physics Library
btSoftBodySolvers.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_SOFT_BODY_SOLVERS_H
17#define BT_SOFT_BODY_SOLVERS_H
18
20
21
22class btSoftBodyTriangleData;
23class btSoftBodyLinkData;
24class btSoftBodyVertexData;
27class btSoftBody;
28
29
31{
32public:
34 {
41 };
42
43
44protected:
47 // Simulation timescale
49
50public:
53 m_timeScale( 1 )
54 {
57 }
58
60 {
61 }
62
66 virtual SolverTypes getSolverType() const = 0;
67
68
70 virtual bool checkInitialized() = 0;
71
73 virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate=false) = 0;
74
76 virtual void copyBackToSoftBodies(bool bMove = true) = 0;
77
79 virtual void predictMotion( float solverdt ) = 0;
80
82 virtual void solveConstraints( float solverdt ) = 0;
83
85 virtual void updateSoftBodies() = 0;
86
88 virtual void processCollision( btSoftBody *, const struct btCollisionObjectWrapper* ) = 0;
89
91 virtual void processCollision( btSoftBody*, btSoftBody* ) = 0;
92
94 virtual void setNumberOfPositionIterations( int iterations )
95 {
97 }
98
101 {
103 }
104
106 virtual void setNumberOfVelocityIterations( int iterations )
107 {
108 m_numberOfVelocityIterations = iterations;
109 }
110
113 {
115 }
116
119 {
120 return m_timeScale;
121 }
122
123#if 0
127 virtual void addCollisionObjectForSoftBody( int clothIdentifier, btCollisionObject *collisionObject ) = 0;
128#endif
129};
130
136{
137protected:
138
139public:
141 {
142 }
143
145 {
146 }
147
148
150 virtual void copySoftBodyToVertexBuffer( const btSoftBody * const softBody, btVertexBufferDescriptor *vertexBuffer ) = 0;
151};
152
153
154#endif // #ifndef BT_SOFT_BODY_SOLVERS_H
btCollisionObject can be used to manage collision detection objects.
Class to manage movement of data from a solver to a given target.
virtual void copySoftBodyToVertexBuffer(const btSoftBody *const softBody, btVertexBufferDescriptor *vertexBuffer)=0
Output current computed vertex data to the vertex buffers for all cloths in the solver.
virtual void processCollision(btSoftBody *, btSoftBody *)=0
Process a collision between two soft bodies.
virtual int getNumberOfVelocityIterations()
Get the number of velocity constraint solver iterations this solver uses.
virtual void setNumberOfVelocityIterations(int iterations)
Set the number of velocity constraint solver iterations this solver uses.
virtual void solveConstraints(float solverdt)=0
Solve constraints for a set of soft bodies.
float getTimeScale()
Return the timescale that the simulation is using.
virtual void predictMotion(float solverdt)=0
Predict motion of soft bodies into next timestep.
virtual void processCollision(btSoftBody *, const struct btCollisionObjectWrapper *)=0
Process a collision between one of the world's soft bodies and another collision object.
virtual void setNumberOfPositionIterations(int iterations)
Set the number of velocity constraint solver iterations this solver uses.
virtual int getNumberOfPositionIterations()
Get the number of velocity constraint solver iterations this solver uses.
virtual SolverTypes getSolverType() const =0
Return the type of the solver.
virtual bool checkInitialized()=0
Ensure that this solver is initialized.
virtual void copyBackToSoftBodies(bool bMove=true)=0
Copy necessary data back to the original soft body source objects.
virtual ~btSoftBodySolver()
virtual void updateSoftBodies()=0
Perform necessary per-step updates of soft bodies such as recomputing normals and bounding boxes.
virtual void optimize(btAlignedObjectArray< btSoftBody * > &softBodies, bool forceUpdate=false)=0
Optimize soft bodies in this solver.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
Definition: btSoftBody.h:72