[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-physics / third-party / bullet3 / src / BulletSoftBody / btDeformableMultiBodyConstraintSolver.h
1 /*
2  Written by Xuchen Han <xuchenhan2015@u.northwestern.edu>
3  
4  Bullet Continuous Collision Detection and Physics Library
5  Copyright (c) 2019 Google Inc. http://bulletphysics.org
6  This software is provided 'as-is', without any express or implied warranty.
7  In no event will the authors be held liable for any damages arising from the use of this software.
8  Permission is granted to anyone to use this software for any purpose,
9  including commercial applications, and to alter it and redistribute it freely,
10  subject to the following restrictions:
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 #ifndef BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H
17 #define BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H
18
19 #include "btDeformableBodySolver.h"
20 #include "BulletDynamics/Featherstone/btMultiBodyConstraintSolver.h"
21
22 class btDeformableBodySolver;
23
24 // btDeformableMultiBodyConstraintSolver extendsn btMultiBodyConstraintSolver to solve for the contact among rigid/multibody and deformable bodies. Notice that the following constraints
25 // 1. rigid/multibody against rigid/multibody
26 // 2. rigid/multibody against deforamble
27 // 3. deformable against deformable
28 // 4. deformable self collision
29 // 5. joint constraints
30 // are all coupled in this solve.
31 ATTRIBUTE_ALIGNED16(class)
32 btDeformableMultiBodyConstraintSolver : public btMultiBodyConstraintSolver
33 {
34         btDeformableBodySolver* m_deformableSolver;
35
36 protected:
37         // override the iterations method to include deformable/multibody contact
38         //    virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject** bodies,int numBodies,btPersistentManifold** manifoldPtr, int numManifolds,btTypedConstraint** constraints,int numConstraints,const btContactSolverInfo& infoGlobal,btIDebugDraw* debugDrawer);
39
40         // write the velocity of the the solver body to the underlying rigid body
41         void solverBodyWriteBack(const btContactSolverInfo& infoGlobal);
42
43         // write the velocity of the underlying rigid body to the the the solver body
44         void writeToSolverBody(btCollisionObject * *bodies, int numBodies, const btContactSolverInfo& infoGlobal);
45
46         // let each deformable body knows which solver body is in constact
47         void pairDeformableAndSolverBody(btCollisionObject** bodies, int numBodies, int numDeformableBodies, const btContactSolverInfo& infoGlobal);
48
49         // Modified by Samsung to compile under GCC13. 2024-01-10. eunkiki.hong@samsung.com
50         using btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIterations;
51         virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
52
53         virtual btScalar solveDeformableGroupIterations(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifoldPtr, int numManifolds, btTypedConstraint** constraints, int numConstraints, const btContactSolverInfo& infoGlobal, btIDebugDraw* debugDrawer);
54
55 public:
56         BT_DECLARE_ALIGNED_ALLOCATOR();
57
58         void setDeformableSolver(btDeformableBodySolver * deformableSolver)
59         {
60                 m_deformableSolver = deformableSolver;
61         }
62
63         virtual void solveDeformableBodyGroup(btCollisionObject * *bodies, int numBodies, btCollisionObject** deformableBodies, int numDeformableBodies, btPersistentManifold** manifold, int numManifolds, btTypedConstraint** constraints, int numConstraints, btMultiBodyConstraint** multiBodyConstraints, int numMultiBodyConstraints, const btContactSolverInfo& info, btIDebugDraw* debugDrawer, btDispatcher* dispatcher);
64 };
65
66 #endif /* BT_DEFORMABLE_MULTIBODY_CONSTRAINT_SOLVER_H */