1 // 2 // DeformableBodyInplaceSolverIslandCallback.h 3 // BulletSoftBody 4 // 5 // Created by Xuchen Han on 12/16/19. 6 // 7 8 #ifndef DeformableBodyInplaceSolverIslandCallback_h 9 #define DeformableBodyInplaceSolverIslandCallback_h 10 11 struct DeformableBodyInplaceSolverIslandCallback : public MultiBodyInplaceSolverIslandCallback 12 { 13 btDeformableMultiBodyConstraintSolver* m_deformableSolver; 14 DeformableBodyInplaceSolverIslandCallbackDeformableBodyInplaceSolverIslandCallback15 DeformableBodyInplaceSolverIslandCallback(btDeformableMultiBodyConstraintSolver* solver, 16 btDispatcher* dispatcher) 17 : MultiBodyInplaceSolverIslandCallback(solver, dispatcher), m_deformableSolver(solver) 18 { 19 } 20 21 22 virtual void processConstraints(int islandId=-1) 23 { 24 btCollisionObject** bodies = m_bodies.size() ? &m_bodies[0] : 0; 25 btCollisionObject** softBodies = m_softBodies.size() ? &m_softBodies[0] : 0; 26 btPersistentManifold** manifold = m_manifolds.size() ? &m_manifolds[0] : 0; 27 btTypedConstraint** constraints = m_constraints.size() ? &m_constraints[0] : 0; 28 btMultiBodyConstraint** multiBodyConstraints = m_multiBodyConstraints.size() ? &m_multiBodyConstraints[0] : 0; 29 30 //printf("mb contacts = %d, mb constraints = %d\n", mbContacts, m_multiBodyConstraints.size()); 31 32 m_deformableSolver->solveDeformableBodyGroup(bodies, m_bodies.size(), softBodies, m_softBodies.size(), manifold, m_manifolds.size(), constraints, m_constraints.size(), multiBodyConstraints, m_multiBodyConstraints.size(), *m_solverInfo, m_debugDrawer, m_dispatcher); 33 if (m_bodies.size() && (m_solverInfo->m_reportSolverAnalytics&1)) 34 { 35 m_deformableSolver->m_analyticsData.m_islandId = islandId; 36 m_islandAnalyticsData.push_back(m_solver->m_analyticsData); 37 } 38 m_bodies.resize(0); 39 m_softBodies.resize(0); 40 m_manifolds.resize(0); 41 m_constraints.resize(0); 42 m_multiBodyConstraints.resize(0); 43 } 44 }; 45 46 #endif /* DeformableBodyInplaceSolverIslandCallback_h */ 47