16 #ifndef BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H
17 #define BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H
33 typedef HRESULT (WINAPI *
CompileFromMemoryFunc)(LPCSTR,SIZE_T,LPCSTR,
const D3D10_SHADER_MACRO*,LPD3D10INCLUDE,LPCSTR,LPCSTR,UINT,UINT,ID3DX11ThreadPump*,ID3D10Blob**,ID3D10Blob**,HRESULT*);
72 KernelDesc
compileComputeShaderFromString(
const char* shaderString,
const char* shaderName,
int constBufferSize, D3D10_SHADER_MACRO *compileMacros = 0 );
522 virtual void integrate(
float solverdt );
675 dxFunctions( dx11Device, dx11Context, dx11CompileFromMemory )
689 #endif // #ifndef BT_ACCELERATED_SOFT_BODY_DX11_SOLVER_H
int getMaxTriangles() const
int getFirstTriangle() const
btDX11Buffer< CollisionObjectIndices > m_dx11PerClothCollisionObjects
btSoftBody * m_softBody
The actual soft body this data represents.
virtual void integrate(float solverdt)
Integrate motion on the solver.
int m_maxVertices
Maximum number of vertices allocated to be part of this cloth.
ID3D11DeviceContext * m_dx11Context
Vectormath::Aos::Vector3 ProjectOnAxis(const Vectormath::Aos::Vector3 &v, const Vectormath::Aos::Vector3 &a)
Vectormath::Aos::Transform3 shapeTransform
Class to manage movement of data from a solver to a given target.
btDX11Buffer< float > m_dx11PerClothDampingFactor
DXFunctions::KernelDesc computeBoundsKernel
DXFunctions::KernelDesc outputToVertexArrayWithoutNormalsKernel
ID3D11ComputeShader * kernel
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
DXFunctions::KernelDesc updatePositionsFromVelocitiesKernel
virtual btSoftBodyTriangleData & getTriangleData()
float computeTriangleArea(const Vectormath::Aos::Point3 &vertex0, const Vectormath::Aos::Point3 &vertex1, const Vectormath::Aos::Point3 &vertex2)
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 normalizeNormalsAndAreas(int numVertices)
void setNumTriangles(int numTriangles)
ID3D11Buffer * constBuffer
int getMaxVertices() const
virtual void processCollision(btSoftBody *, const btCollisionObjectWrapper *)
btDX11Buffer< float > m_dx11PerClothDragFactor
bool getEnableUpdateBounds() const
btAlignedObjectArray< float > m_perClothVelocityCorrectionCoefficient
Velocity correction coefficient.
CollisionObjectIndices(int f, int e)
virtual void updateSoftBodies()
Perform necessary per-step updates of soft bodies such as recomputing normals and bounding boxes...
void setMaxTriangles(int maxTriangles)
ID3D11Device * m_dx11Device
btAlignedObjectArray< CollisionObjectIndices > m_perClothCollisionObjects
Collision shape details: pair of index of first collision shape for the cloth and number of collision...
DXFunctions(ID3D11Device *dx11Device, ID3D11DeviceContext *dx11Context, CompileFromMemoryFunc dx11CompileFromMemory)
void updateVelocitiesFromPositionsWithVelocities(float isolverdt)
DXFunctions::KernelDesc applyForcesKernel
Class to manage movement of data from a solver to a given target.
void updateVelocitiesFromPositionsWithoutVelocities(float isolverdt)
void resetNormalsAndAreas(int numVertices)
void updateBounds(const btVector3 &lowerBound, const btVector3 &upperBound)
Update the bounds in the btSoftBody object.
DXFunctions::KernelDesc addVelocityKernel
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 setNumLinks(int numLinks)
virtual ~btDX11SoftBodySolver()
btAlignedObjectArray< UIntVector3 > m_perClothMinBounds
Minimum bounds for each cloth.
virtual SolverTypes getSolverType() const
Return the type of the solver.
void setMaxLinks(int maxLinks)
btSoftBodySolverOutputDXtoDX(ID3D11Device *dx11Device, ID3D11DeviceContext *dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory=&D3DX11CompileFromMemory)
btAcceleratedSoftBodyInterface * findSoftBodyInterface(const btSoftBody *const softBody)
bool m_enableUpdateBounds
DXFunctions::KernelDesc solvePositionsFromLinksKernel
btDX11Buffer< float > m_dx11PerClothVelocityCorrectionCoefficient
void solveLinksForPosition(int startLink, int numLinks, float kst, float ti)
btAlignedObjectArray< float > m_perClothMediumDensity
Density of the medium in which each cloth sits.
int m_maxTriangles
Maximum number of triangles allocated to be part of this cloth.
void setFirstVertex(int firstVertex)
void updatePositionsFromVelocities(float solverdt)
DXFunctions::KernelDesc solveCollisionsAndUpdateVelocitiesKernel
KernelDesc compileComputeShaderFromString(const char *shaderString, const char *shaderName, int constBufferSize, D3D10_SHADER_MACRO *compileMacros=0)
Compile a compute shader kernel from a string and return the appropriate KernelDesc object...
DXFunctions::KernelDesc updateSoftBodiesKernel
int m_firstVertex
Index of first vertex in the world allocated to this cloth.
virtual btSoftBodyVertexData & getVertexData()
btAlignedObjectArray< float > m_perClothDampingFactor
Velocity damping factor.
SoftBody class to maintain information about a soft body instance within a solver.
btSoftBodyLinkDataDX11 m_linkData
Link data for all cloths.
int m_maxLinks
Maximum number of links allocated to this cloth.
btDX11Buffer< float > m_dx11PerClothLiftFactor
DXFunctions::KernelDesc prepareLinksKernel
DXFunctions::KernelDesc resetNormalsAndAreasKernel
btAcceleratedSoftBodyInterface(btSoftBody *softBody)
void setNumVertices(int numVertices)
btDX11Buffer< Vectormath::Aos::Vector3 > m_dx11PerClothWindVelocity
DXFunctions::KernelDesc normalizeNormalsAndAreasKernel
CollisionShapeDescription()
virtual btSoftBodyLinkData & getLinkData()
btAlignedObjectArray< float > m_perClothFriction
Friction coefficient for each cloth.
virtual void solveConstraints(float solverdt)
Solve constraints for a set of soft bodies.
btDX11Buffer< CollisionShapeDescription > m_dx11CollisionObjectDetails
ID3D11DeviceContext * m_dx11Context
void setMaxVertices(int maxVertices)
DXFunctions::KernelDesc integrateKernel
btAlignedObjectArray< Vectormath::Aos::Vector3 > m_perClothWindVelocity
Wind velocity to be applied normal to all non-static vertices in the solver.
virtual void copyBackToSoftBodies(bool bMove=true)
Copy necessary data back to the original soft body source objects.
void ApplyClampedForce(float solverdt, const Vectormath::Aos::Vector3 &force, const Vectormath::Aos::Vector3 &vertexVelocity, float inverseMass, Vectormath::Aos::Vector3 &vertexForce)
btVector3 can be used to represent 3D points and vectors.
btAlignedObjectArray< btAcceleratedSoftBodyInterface * > m_softBodySet
Cloths owned by this solver.
Vectormath::Aos::Vector3 angularVelocity
virtual void applyForces(float solverdt)
virtual void predictMotion(float solverdt)
Predict motion of soft bodies into next timestep.
Wrapper for vertex data information.
void executeUpdateSoftBodies(int firstTriangle, int numTriangles)
btSoftBodySolverOutputDXtoCPU()
btAlignedObjectArray< float > m_perClothDragFactor
Drag parameter for wind effect on cloth.
btDX11Buffer< float > m_dx11PerClothMediumDensity
Entry in the collision shape array.
~btSoftBodySolverOutputDXtoDX()
CompileFromMemoryFunc m_dx11CompileFromMemory
btDX11Buffer< UIntVector3 > m_dx11PerClothMinBounds
Class to manage movement of data from a solver to a given target.
btSoftBodyVertexDataDX11 m_vertexData
btAlignedObjectArray< CollisionShapeDescription > m_collisionObjectDetails
Collision shapes being passed across to the cloths in this solver.
virtual bool checkInitialized()
Ensure that this solver is initialized.
UIntVector3(unsigned int x_, unsigned int y_, unsigned int z_)
btAlignedObjectArray< float > m_perClothLiftFactor
Lift parameter for wind effect on cloth.
int m_firstLink
Index of first link in the world allocated to this cloth.
void solveLinksForVelocity(int startLink, int numLinks, float kst)
DXFunctions::KernelDesc updateVelocitiesFromPositionsWithoutVelocitiesKernel
DXFunctions::KernelDesc outputToVertexArrayWithNormalsKernel
void setFirstLink(int firstLink)
bool m_shadersInitialized
int m_numLinks
Current number of links allocated to this cloth.
Vectormath::Aos::Vector3 linearVelocity
btSoftBodyTriangleDataDX11 m_triangleData
int getNumTriangles() const
int getNumVertices() const
DXFunctions::KernelDesc updateVelocitiesFromPositionsWithVelocitiesKernel
int getFirstVertex() const
void prepareCollisionConstraints()
Sort the collision object details array and generate indexing into it for the per-cloth collision obj...
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
int findSoftBodyIndex(const btSoftBody *const softBody)
void solveCollisionsAndUpdateVelocities(float isolverdt)
btDX11Buffer< float > m_dx11PerClothFriction
HRESULT(WINAPI * CompileFromMemoryFunc)(LPCSTR, SIZE_T, LPCSTR, const D3D10_SHADER_MACRO *, LPD3D10INCLUDE, LPCSTR, LPCSTR, UINT, UINT, ID3DX11ThreadPump *, ID3D10Blob **, ID3D10Blob **, HRESULT *)
ID3D11Device * m_dx11Device
void setEnableUpdateBounds(bool enableBounds)
int m_firstTriangle
Index of first triangle in the world allocated to this cloth.
btDX11Buffer< UIntVector3 > m_dx11PerClothMaxBounds
btDX11SoftBodySolver(ID3D11Device *dx11Device, ID3D11DeviceContext *dx11Context, DXFunctions::CompileFromMemoryFunc dx11CompileFromMemory=&D3DX11CompileFromMemory)
bool m_updateSolverConstants
Variable to define whether we need to update solver constants on the next iteration.
virtual bool buildShaders()
virtual void optimize(btAlignedObjectArray< btSoftBody * > &softBodies, bool forceUpdate=false)
Optimize soft bodies in this solver.
int m_numVertices
Current number of vertices that are part of this cloth.
DXFunctions::KernelDesc vSolveLinksKernel
int m_numTriangles
Current number of triangles that are part of this cloth.
bool m_shadersInitialized
btDX11Buffer< Vectormath::Aos::Vector3 > m_dx11PerClothAcceleration
void setFirstTriangle(int firstTriangle)
virtual void updateConstants(float timeStep)
virtual void prepareLinks()
btSoftBody * getSoftBody()
btAlignedObjectArray< UIntVector3 > m_perClothMaxBounds
Maximum bounds for each cloth.
btAlignedObjectArray< Vectormath::Aos::Vector3 > m_perClothAcceleration
Acceleration value to be applied to all non-static vertices in the solver.