16 #ifndef BT_SOFT_BODY_SOLVER_OPENCL_H
17 #define BT_SOFT_BODY_SOLVER_OPENCL_H
419 virtual void integrate(
float solverdt );
527 #endif // #ifndef BT_SOFT_BODY_SOLVER_OPENCL_H
void setFirstTriangle(int firstTriangle)
btOpenCLBuffer< Vectormath::Aos::Point3 > m_clAnchorPosition
btAlignedObjectArray< float > m_perClothDragFactor
Drag parameter for wind effect on cloth.
virtual void solveCollisionsAndUpdateVelocities(float isolverdt)
struct _cl_context * cl_context
btOpenCLBuffer< float > m_clPerClothLiftFactor
int m_numTriangles
Current number of triangles that are part of this cloth.
Vectormath::Aos::Vector3 linearVelocity
cl_kernel m_normalizeNormalsAndAreasKernel
virtual void applyForces(float solverdt)
virtual void predictMotion(float solverdt)
Predict motion of soft bodies into next timestep.
cl_kernel m_solvePositionsFromLinksKernel
CLFunctions m_defaultCLFunctions
btOpenCLBuffer< float > m_clPerClothFriction
virtual size_t getDefaultWorkGroupSize() const
cl_command_queue m_cqCommandQue
float computeTriangleArea(const Vectormath::Aos::Point3 &vertex0, const Vectormath::Aos::Point3 &vertex1, const Vectormath::Aos::Point3 &vertex2)
void solveLinksForVelocity(int startLink, int numLinks, float kst)
void setMaxTriangles(int maxTriangles)
CLFunctions * m_currentCLFunctions
btAlignedObjectArray< CollisionObjectIndices > m_perClothCollisionObjects
Collision shape details: pair of index of first collision shape for the cloth and number of collision...
virtual void setDefaultWorkgroupSize(size_t workGroupSize)
virtual void copySoftBodyToVertexBuffer(const btSoftBody *const softBody, btVertexBufferDescriptor *vertexBuffer)
Output current computed vertex data to the vertex buffers for all cloths in the solver.
void resetNormalsAndAreas(int numVertices)
btSoftBodyLinkDataOpenCL m_linkData
virtual SolverTypes getSolverType() const
Return the type of the solver.
virtual cl_kernel compileCLKernelFromString(const char *kernelSource, const char *kernelName, const char *additionalMacros, const char *srcFileNameForCaching)
Compile a compute shader kernel from a string and return the appropriate cl_kernel object...
SoftBody class to maintain information about a soft body instance within a solver.
cl_command_queue m_cqCommandQue
void ApplyClampedForce(float solverdt, const Vectormath::Aos::Vector3 &force, const Vectormath::Aos::Vector3 &vertexVelocity, float inverseMass, Vectormath::Aos::Vector3 &vertexForce)
virtual bool checkInitialized()
Ensure that this solver is initialized.
int m_maxTriangles
Maximum number of triangles allocated to be part of this cloth.
void normalizeNormalsAndAreas(int numVertices)
int getKernelCompilationFailures() const
cl_kernel m_updateVelocitiesFromPositionsWithVelocitiesKernel
bool m_shadersInitialized
cl_kernel m_integrateKernel
int m_maxVertices
Maximum number of vertices allocated to be part of this cloth.
btSoftBodyTriangleDataOpenCL m_triangleData
int findSoftBodyIndex(const btSoftBody *const softBody)
int m_kernelCompilationFailures
btAlignedObjectArray< btOpenCLAcceleratedSoftBodyInterface * > m_softBodySet
Cloths owned by this solver.
btAlignedObjectArray< Vectormath::Aos::Vector3 > m_perClothWindVelocity
Wind velocity to be applied normal to all non-static vertices in the solver.
btOpenCLBuffer< CollisionShapeDescription > m_clCollisionObjectDetails
static const size_t workGroupSize
btOpenCLBuffer< Vectormath::Aos::Vector3 > m_clPerClothAcceleration
btOpenCLAcceleratedSoftBodyInterface(btSoftBody *softBody)
CollisionObjectIndices(int f, int e)
virtual void copyBackToSoftBodies(bool bMove=true)
Copy necessary data back to the original soft body source objects.
void updateFixedVertexPositions()
btAlignedObjectArray< Vectormath::Aos::Vector3 > m_perClothAcceleration
Acceleration value to be applied to all non-static vertices in the solver.
btAlignedObjectArray< AnchorNodeInfoCL > m_anchorNodeInfoArray
Vectormath::Aos::Transform3 shapeTransform
btOpenCLSoftBodySolver(cl_command_queue queue, cl_context ctx, bool bUpdateAchchoredNodePos=false)
int m_numVertices
Current number of vertices that are part of this cloth.
virtual btSoftBodyLinkData & getLinkData()
Entry in the collision shape array.
cl_kernel m_resetNormalsAndAreasKernel
void setMaxLinks(int maxLinks)
struct _cl_kernel * cl_kernel
bool m_bUpdateAnchoredNodePos
cl_kernel m_prepareLinksKernel
void setFirstVertex(int firstVertex)
virtual bool buildShaders()
cl_kernel m_applyForcesKernel
CLFunctions(cl_command_queue cqCommandQue, cl_context cxMainContext)
btAlignedObjectArray< int > m_anchorIndex
int m_firstLink
Index of first link in the world allocated to this cloth.
cl_kernel m_updateSoftBodiesKernel
int m_firstTriangle
Index of first triangle in the world allocated to this cloth.
virtual void integrate(float solverdt)
Integrate motion on the solver.
cl_context m_cxMainContext
void updateBounds(const btVector3 &lowerBound, const btVector3 &upperBound)
Update the bounds in the btSoftBody object.
cl_kernel m_vSolveLinksKernel
virtual void processCollision(btSoftBody *, const btCollisionObjectWrapper *)
btAlignedObjectArray< float > m_perClothDampingFactor
Velocity damping factor.
btAlignedObjectArray< float > m_perClothVelocityCorrectionCoefficient
Velocity correction coefficient.
btAlignedObjectArray< float > m_perClothFriction
Friction coefficient for each cloth.
btSoftBody * m_softBody
The actual soft body this data represents.
void updateVelocitiesFromPositionsWithVelocities(float isolverdt)
UIntVector3(unsigned int x_, unsigned int y_, unsigned int z_)
btVector3 can be used to represent 3D points and vectors.
void prepareCollisionConstraints()
Sort the collision object details array and generate indexing into it for the per-cloth collision obj...
Vectormath::Aos::Vector3 ProjectOnAxis(const Vectormath::Aos::Vector3 &v, const Vectormath::Aos::Vector3 &a)
cl_kernel m_addVelocityKernel
void clearKernelCompilationFailures()
btOpenCLBuffer< float > m_clPerClothMediumDensity
Wrapper for vertex data information.
int m_numLinks
Current number of links allocated to this cloth.
btOpenCLBuffer< float > m_clPerClothDampingFactor
virtual void solveLinksForPosition(int startLink, int numLinks, float kst, float ti)
void executeUpdateSoftBodies(int firstTriangle, int numTriangles)
int m_firstVertex
Index of first vertex in the world allocated to this cloth.
void setCLFunctions(CLFunctions *funcs)
virtual void updateConstants(float timeStep)
btOpenCLAcceleratedSoftBodyInterface * findSoftBodyInterface(const btSoftBody *const softBody)
btAlignedObjectArray< float > m_perClothLiftFactor
Lift parameter for wind effect on cloth.
void updateVelocitiesFromPositionsWithoutVelocities(float isolverdt)
Vectormath::Aos::Vector3 angularVelocity
int m_maxLinks
Maximum number of links allocated to this cloth.
void setNumVertices(int numVertices)
Class to manage movement of data from a solver to a given target.
btSoftBodySolverOutputCLtoCPU()
virtual btSoftBodyVertexData & getVertexData()
struct _cl_command_queue * cl_command_queue
void setMaxVertices(int maxVertices)
cl_kernel m_updateConstantsKernel
btOpenCLBuffer< Vectormath::Aos::Vector3 > m_clPerClothWindVelocity
Class to manage movement of data from a solver to a given target.
void setNumLinks(int numLinks)
void setFirstLink(int firstLink)
cl_kernel m_outputToVertexArrayKernel
virtual ~btOpenCLSoftBodySolver()
CollisionShapeDescription()
btAlignedObjectArray< CollisionShapeDescription > m_collisionObjectDetails
Collision shapes being passed across to the cloths in this solver.
void updatePositionsFromVelocities(float solverdt)
virtual void optimize(btAlignedObjectArray< btSoftBody * > &softBodies, bool forceUpdate=false)
Optimize soft bodies in this solver.
cl_kernel m_solveCollisionsAndUpdateVelocitiesKernel
virtual void updateSoftBodies()
Perform necessary per-step updates of soft bodies such as recomputing normals and bounding boxes...
cl_kernel m_updateFixedVertexPositionsKernel
void setNumTriangles(int numTriangles)
btAlignedObjectArray< float > m_perClothMediumDensity
Density of the medium in which each cloth sits.
bool m_updateSolverConstants
Variable to define whether we need to update solver constants on the next iteration.
btOpenCLBuffer< float > m_clPerClothVelocityCorrectionCoefficient
btOpenCLBuffer< float > m_clPerClothDragFactor
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
virtual btSoftBodyTriangleData & getTriangleData()
btSoftBodyVertexDataOpenCL m_vertexData
btAlignedObjectArray< Vectormath::Aos::Point3 > m_anchorPosition
cl_kernel m_updatePositionsFromVelocitiesKernel
cl_kernel m_updateVelocitiesFromPositionsWithoutVelocitiesKernel
virtual void solveConstraints(float solverdt)
Solve constraints for a set of soft bodies.
btSoftBody * getSoftBody()
btOpenCLBuffer< CollisionObjectIndices > m_clPerClothCollisionObjects
cl_context m_cxMainContext
size_t m_defaultWorkGroupSize
btOpenCLBuffer< int > m_clAnchorIndex