Bullet Collision Detection & Physics Library
btSoftBodySolverLinkData_DX11.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 
19 
20 
21 #ifndef BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H
22 #define BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H
23 
24 struct ID3D11Device;
25 struct ID3D11DeviceContext;
26 
27 
29 {
30 public:
31  bool m_onGPU;
32  ID3D11Device *m_d3dDevice;
33  ID3D11DeviceContext *m_d3dDeviceContext;
34 
35 
44 
45  struct BatchPair
46  {
47  int start;
48  int length;
49 
51  start(0),
52  length(0)
53  {
54  }
55 
56  BatchPair( int s, int l ) :
57  start( s ),
58  length( l )
59  {
60  }
61  };
62 
68 
73 
74 
75  //ID3D11Buffer* readBackBuffer;
76 
77  btSoftBodyLinkDataDX11( ID3D11Device *d3dDevice, ID3D11DeviceContext *d3dDeviceContext );
78 
79  virtual ~btSoftBodyLinkDataDX11();
80 
82  virtual void createLinks( int numLinks );
83 
85  virtual void setLinkAt( const LinkDescription &link, int linkIndex );
86 
87  virtual bool onAccelerator();
88 
89  virtual bool moveToAccelerator();
90 
91  virtual bool moveFromAccelerator();
92 
99  void generateBatches();
100 };
101 
102 
103 #endif // #ifndef BT_SOFT_BODY_SOLVER_LINK_DATA_DX11_H
virtual void setLinkAt(const LinkDescription &link, int linkIndex)
Insert the link described into the correct data structures assuming space has already been allocated ...
btDX11Buffer< float > m_dx11LinksMaterialLinearStiffnessCoefficient
void generateBatches()
Generate (and later update) the batching for the entire link set.
virtual bool onAccelerator()
Return true if data is on the accelerator.
btDX11Buffer< float > m_dx11LinksLengthRatio
virtual void createLinks(int numLinks)
Allocate enough space in all link-related arrays to fit numLinks links.
btDX11Buffer< float > m_dx11LinkStrength
btDX11Buffer< float > m_dx11LinksRestLength
btAlignedObjectArray< int > m_linkAddresses
Link addressing information for each cloth.
virtual bool moveToAccelerator()
Move data from host memory to the accelerator.
btDX11Buffer< LinkNodePair > m_dx11Links
Class describing a link for input into the system.
btDX11Buffer< float > m_dx11LinksMassLSC
ID3D11DeviceContext * m_d3dDeviceContext
btDX11Buffer< Vectormath::Aos::Vector3 > m_dx11LinksCLength
btDX11Buffer< float > m_dx11LinksRestLengthSquared
btAlignedObjectArray< BatchPair > m_batchStartLengths
Start and length values for computation batches over link data.
btSoftBodyLinkDataDX11(ID3D11Device *d3dDevice, ID3D11DeviceContext *d3dDeviceContext)
virtual bool moveFromAccelerator()
Move data from host memory from the accelerator.