00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 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. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #include "vectormath/vmInclude.h" 00017 #include "btSoftBodySolver_DX11.h" 00018 #include "btSoftBodySolverVertexBuffer_DX11.h" 00019 #include "btSoftBodySolverLinkData_DX11SIMDAware.h" 00020 #include "btSoftBodySolverVertexData_DX11.h" 00021 #include "btSoftBodySolverTriangleData_DX11.h" 00022 00023 00024 #ifndef BT_SOFT_BODY_DX11_SOLVER_SIMDAWARE_H 00025 #define BT_SOFT_BODY_DX11_SOLVER_SIMDAWARE_H 00026 00027 class btDX11SIMDAwareSoftBodySolver : public btDX11SoftBodySolver 00028 { 00029 protected: 00030 struct SolvePositionsFromLinksKernelCB 00031 { 00032 int startWave; 00033 int numWaves; 00034 float kst; 00035 float ti; 00036 }; 00037 00038 00040 btSoftBodyLinkDataDX11SIMDAware m_linkData; 00041 00043 bool m_updateSolverConstants; 00044 00045 00046 virtual bool buildShaders(); 00047 00048 void updateConstants( float timeStep ); 00049 00050 00052 // Kernel dispatches 00053 00054 00055 void solveLinksForPosition( int startLink, int numLinks, float kst, float ti ); 00056 00057 // End kernel dispatches 00059 00060 00061 00062 public: 00063 btDX11SIMDAwareSoftBodySolver(ID3D11Device * dx11Device, ID3D11DeviceContext* dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory = &D3DX11CompileFromMemory); 00064 00065 virtual ~btDX11SIMDAwareSoftBodySolver(); 00066 00067 virtual btSoftBodyLinkData &getLinkData(); 00068 00069 virtual void optimize( btAlignedObjectArray< btSoftBody * > &softBodies , bool forceUpdate=false); 00070 00071 virtual void solveConstraints( float solverdt ); 00072 00073 virtual SolverTypes getSolverType() const 00074 { 00075 return DX_SIMD_SOLVER; 00076 } 00077 00078 }; 00079 00080 #endif // #ifndef BT_SOFT_BODY_DX11_SOLVER_SIMDAWARE_H 00081