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 00017 #include "BulletMultiThreaded/GpuSoftBodySolvers/Shared/btSoftBodySolverData.h" 00018 #include "btSoftBodySolverBuffer_DX11.h" 00019 00020 00021 #ifndef BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H 00022 #define BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H 00023 00024 struct ID3D11Device; 00025 struct ID3D11DeviceContext; 00026 00027 00028 class btSoftBodyLinkDataDX11 : public btSoftBodyLinkData 00029 { 00030 public: 00031 bool m_onGPU; 00032 ID3D11Device *m_d3dDevice; 00033 ID3D11DeviceContext *m_d3dDeviceContext; 00034 00035 00036 btDX11Buffer<LinkNodePair> m_dx11Links; 00037 btDX11Buffer<float> m_dx11LinkStrength; 00038 btDX11Buffer<float> m_dx11LinksMassLSC; 00039 btDX11Buffer<float> m_dx11LinksRestLengthSquared; 00040 btDX11Buffer<Vectormath::Aos::Vector3> m_dx11LinksCLength; 00041 btDX11Buffer<float> m_dx11LinksLengthRatio; 00042 btDX11Buffer<float> m_dx11LinksRestLength; 00043 btDX11Buffer<float> m_dx11LinksMaterialLinearStiffnessCoefficient; 00044 00045 struct BatchPair 00046 { 00047 int start; 00048 int length; 00049 00050 BatchPair() : 00051 start(0), 00052 length(0) 00053 { 00054 } 00055 00056 BatchPair( int s, int l ) : 00057 start( s ), 00058 length( l ) 00059 { 00060 } 00061 }; 00062 00067 btAlignedObjectArray< int > m_linkAddresses; 00068 00072 btAlignedObjectArray< BatchPair > m_batchStartLengths; 00073 00074 00075 //ID3D11Buffer* readBackBuffer; 00076 00077 btSoftBodyLinkDataDX11( ID3D11Device *d3dDevice, ID3D11DeviceContext *d3dDeviceContext ); 00078 00079 virtual ~btSoftBodyLinkDataDX11(); 00080 00082 virtual void createLinks( int numLinks ); 00083 00085 virtual void setLinkAt( const LinkDescription &link, int linkIndex ); 00086 00087 virtual bool onAccelerator(); 00088 00089 virtual bool moveToAccelerator(); 00090 00091 virtual bool moveFromAccelerator(); 00092 00099 void generateBatches(); 00100 }; 00101 00102 00103 #endif // #ifndef BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H