89 int numVertices = clothVertices.
size();
98 float *vertexPointer = basePointer + vertexOffset;
100 for(
int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex )
102 btVector3 position = clothVertices[vertexIndex].m_x;
103 *(vertexPointer + 0) = position.
getX();
104 *(vertexPointer + 1) = position.
getY();
105 *(vertexPointer + 2) = position.
getZ();
106 vertexPointer += vertexStride;
113 float *normalPointer = basePointer + normalOffset;
115 for(
int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex )
117 btVector3 normal = clothVertices[vertexIndex].m_n;
118 *(normalPointer + 0) = normal.
getX();
119 *(normalPointer + 1) = normal.
getY();
120 *(normalPointer + 2) = normal.
getZ();
121 normalPointer += normalStride;
virtual void solveConstraints(float solverdt)
Solve constraints for a set of soft bodies.
virtual void predictMotion(float solverdt)
Predict motion of soft bodies into next timestep.
virtual bool hasVertexPositions() const
void defaultCollisionHandler(const btCollisionObjectWrapper *pcoWrap)
btDefaultSoftBodySolver()
virtual BufferTypes getBufferType() const =0
Return the type of the vertex buffer descriptor.
bool m_updateSolverConstants
Variable to define whether we need to update solver constants on the next iteration.
void copyFromArray(const btAlignedObjectArray &otherArray)
const btScalar & getZ() const
Return the z value.
virtual void copyBackToSoftBodies(bool bMove=true)
Copy necessary data back to the original soft body source objects.
int size() const
return the number of elements in the array
virtual void optimize(btAlignedObjectArray< btSoftBody * > &softBodies, bool forceUpdate=false)
Optimize soft bodies in this solver.
const btScalar & getY() const
Return the y value.
void predictMotion(btScalar dt)
const btScalar & getX() const
Return the x value.
virtual int getVertexStride() const
Return the vertex stride in number of floats between vertices.
virtual void updateSoftBodies()
Perform necessary per-step updates of soft bodies such as recomputing normals and bounding boxes...
btVector3 can be used to represent 3D points and vectors.
btAlignedObjectArray< btSoftBody * > m_softBodySet
virtual int getVertexOffset() const
Return the vertex offset in floats from the base pointer.
virtual bool checkInitialized()
Ensure that this solver is initialized.
virtual void processCollision(btSoftBody *, const btCollisionObjectWrapper *)
virtual int getNormalOffset() const
Return the vertex offset in floats from the base pointer.
virtual float * getBasePointer() const
Return the base pointer in memory to the first vertex.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
virtual bool hasNormals() const
virtual int getNormalStride() const
Return the vertex stride in number of floats between vertices.
virtual void copySoftBodyToVertexBuffer(const btSoftBody *const softBody, btVertexBufferDescriptor *vertexBuffer)
virtual ~btDefaultSoftBodySolver()