Bullet Collision Detection & Physics Library
btSoftBodySolver_OpenCLSIMDAware.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4 
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:
10 
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.
14 */
15 
16 #ifndef BT_SOFT_BODY_SOLVER_OPENCL_SIMDAWARE_H
17 #define BT_SOFT_BODY_SOLVER_OPENCL_SIMDAWARE_H
18 
19 #include "stddef.h" //for size_t
20 #include "vectormath/vmInclude.h"
21 
27 
28 
29 
30 
31 
33 {
34 protected:
35 
36 
38 
39 
40 
41 
42  virtual bool buildShaders();
43 
44 
45  void updateConstants( float timeStep );
46 
47  float computeTriangleArea(
48  const Vectormath::Aos::Point3 &vertex0,
49  const Vectormath::Aos::Point3 &vertex1,
50  const Vectormath::Aos::Point3 &vertex2 );
51 
52 
54  // Kernel dispatches
55  void solveLinksForPosition( int startLink, int numLinks, float kst, float ti );
56 
57  void solveCollisionsAndUpdateVelocities( float isolverdt );
58  // End kernel dispatches
60 
61 public:
62  btOpenCLSoftBodySolverSIMDAware(cl_command_queue queue,cl_context ctx, bool bUpdateAchchoredNodePos = false);
63 
65 
66  virtual SolverTypes getSolverType() const
67  {
68  return CL_SIMD_SOLVER;
69  }
70 
71 
73 
74 
75  virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate=false);
76 
77  virtual void solveConstraints( float solverdt );
78 
79 }; // btOpenCLSoftBodySolverSIMDAware
80 
81 #endif // #ifndef BT_SOFT_BODY_SOLVER_OPENCL_SIMDAWARE_H
struct _cl_context * cl_context
Definition: cl.h:41
void solveLinksForPosition(int startLink, int numLinks, float kst, float ti)
virtual SolverTypes getSolverType() const
Return the type of the solver.
virtual void optimize(btAlignedObjectArray< btSoftBody * > &softBodies, bool forceUpdate=false)
Optimize soft bodies in this solver.
btOpenCLSoftBodySolverSIMDAware(cl_command_queue queue, cl_context ctx, bool bUpdateAchchoredNodePos=false)
btSoftBodyLinkDataOpenCLSIMDAware m_linkData
struct _cl_command_queue * cl_command_queue
Definition: cl.h:42
float computeTriangleArea(const Vectormath::Aos::Point3 &vertex0, const Vectormath::Aos::Point3 &vertex1, const Vectormath::Aos::Point3 &vertex2)
virtual void solveConstraints(float solverdt)
Solve constraints for a set of soft bodies.