diff --git a/Demos/DX11ClothDemo/cloth_renderer.cpp b/Demos/DX11ClothDemo/cloth_renderer.cpp index 8c6031152..a0bbb665e 100644 --- a/Demos/DX11ClothDemo/cloth_renderer.cpp +++ b/Demos/DX11ClothDemo/cloth_renderer.cpp @@ -496,7 +496,11 @@ void initBullet(void) #endif #endif + if (g_dx11SIMDSolver) + g_dx11SIMDSolver->setEnableUpdateBounds(true); + if (g_dx11Solver) + g_dx11Solver->setEnableUpdateBounds(true); // Initialise CPU physics device //m_collisionConfiguration = new btDefaultCollisionConfiguration(); diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.cpp b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.cpp index 8101ae296..10f437738 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.cpp +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.cpp @@ -565,7 +565,8 @@ btDX11SoftBodySolver::btDX11SoftBodySolver(ID3D11Device * dx11Device, ID3D11Devi m_dx11CollisionObjectDetails( m_dx11Device, m_dx11Context, &m_collisionObjectDetails, true ), m_dx11PerClothMinBounds( m_dx11Device, m_dx11Context, &m_perClothMinBounds, false ), m_dx11PerClothMaxBounds( m_dx11Device, m_dx11Context, &m_perClothMaxBounds, false ), - m_dx11PerClothFriction( m_dx11Device, m_dx11Context, &m_perClothFriction, false ) + m_dx11PerClothFriction( m_dx11Device, m_dx11Context, &m_perClothFriction, false ), + m_enableUpdateBounds(false) { // Initial we will clearly need to update solver constants // For now this is global for the cloths linked with this solver - we should probably make this body specific @@ -2201,7 +2202,8 @@ void btDX11SoftBodySolver::predictMotion( float timeStep ) // Update bounds // Will update the bounds for all softBodies being dealt with by the solver and // set the values in the btSoftBody object - updateBounds(); + if (m_enableUpdateBounds) + updateBounds(); // End prediction work for solvers } diff --git a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h index 6721e35b6..94520ca09 100644 --- a/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h +++ b/src/BulletMultiThreaded/GpuSoftBodySolvers/DX11/btSoftBodySolver_DX11.h @@ -212,6 +212,7 @@ public: */ void updateBounds( const btVector3 &lowerBound, const btVector3 &upperBound ); + // TODO: All of these set functions will have to do checks and // update the world because restructuring of the arrays will be necessary // Reasonable use of "friend"? @@ -513,6 +514,7 @@ protected: DXFunctions::KernelDesc applyForcesKernel; + bool m_enableUpdateBounds; /** * Integrate motion on the solver. @@ -575,6 +577,16 @@ public: return DX_SOLVER; } + void setEnableUpdateBounds(bool enableBounds) + { + m_enableUpdateBounds = enableBounds; + } + bool getEnableUpdateBounds() const + { + return m_enableUpdateBounds; + } + + virtual btSoftBodyLinkData &getLinkData();