Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / PhysicsEffects / include / physics_effects / low_level / solver / pfx_constraint_solver.h
1 /*\r
2 Physics Effects Copyright(C) 2010 Sony Computer Entertainment Inc.\r
3 All rights reserved.\r
4 \r
5 Physics Effects is open software; you can redistribute it and/or\r
6 modify it under the terms of the BSD License.\r
7 \r
8 Physics Effects is distributed in the hope that it will be useful,\r
9 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
11 See the BSD License for more details.\r
12 \r
13 A copy of the BSD License is distributed with\r
14 Physics Effects under the filename: physics_effects_license.txt\r
15 */\r
16 \r
17 #ifndef _SCE_PFX_CONSTRAINT_SOLVER_H\r
18 #define _SCE_PFX_CONSTRAINT_SOLVER_H\r
19 \r
20 #include "../../base_level/rigidbody/pfx_rigid_body.h"\r
21 #include "../../base_level/rigidbody/pfx_rigid_state.h"\r
22 #include "../../base_level/solver/pfx_solver_body.h"\r
23 #include "../../base_level/solver/pfx_constraint_pair.h"\r
24 #include "../../base_level/solver/pfx_joint.h"\r
25 #include "../../base_level/collision/pfx_contact_manifold.h"\r
26 \r
27 #include "../task/pfx_task_manager.h"\r
28 \r
29 namespace sce {\r
30 namespace PhysicsEffects {\r
31 \r
32 ///////////////////////////////////////////////////////////////////////////////\r
33 // Setup Solver Bodies\r
34 \r
35 struct PfxSetupSolverBodiesParam {\r
36         PfxRigidState *states;\r
37         PfxRigidBody *bodies;\r
38         PfxSolverBody *solverBodies;\r
39         PfxUInt32 numRigidBodies;\r
40 };\r
41 \r
42 PfxInt32 pfxSetupSolverBodies(PfxSetupSolverBodiesParam &param);\r
43 \r
44 PfxInt32 pfxSetupSolverBodies(PfxSetupSolverBodiesParam &param,PfxTaskManager *taskManager);\r
45 \r
46 ///////////////////////////////////////////////////////////////////////////////\r
47 // Setup Constraints\r
48 \r
49 struct PfxSetupContactConstraintsParam {\r
50         PfxConstraintPair *contactPairs;\r
51         PfxUInt32 numContactPairs;\r
52         PfxContactManifold *offsetContactManifolds;\r
53         PfxRigidState *offsetRigidStates;\r
54         PfxRigidBody *offsetRigidBodies;\r
55         PfxSolverBody *offsetSolverBodies;\r
56         PfxUInt32 numRigidBodies;\r
57         PfxFloat timeStep;\r
58         PfxFloat separateBias;\r
59         \r
60         PfxSetupContactConstraintsParam()\r
61         {\r
62                 timeStep = 0.016f;\r
63                 separateBias = 0.2f;\r
64         }\r
65 };\r
66 \r
67 PfxInt32 pfxSetupContactConstraints(PfxSetupContactConstraintsParam &param);\r
68 \r
69 PfxInt32 pfxSetupContactConstraints(PfxSetupContactConstraintsParam &param,PfxTaskManager *taskManager);\r
70 \r
71 struct PfxSetupJointConstraintsParam {\r
72         PfxConstraintPair *jointPairs;\r
73         PfxUInt32 numJointPairs;\r
74         PfxJoint *offsetJoints;\r
75         PfxRigidState *offsetRigidStates;\r
76         PfxRigidBody *offsetRigidBodies;\r
77         PfxSolverBody *offsetSolverBodies;\r
78         PfxUInt32 numRigidBodies;\r
79         PfxFloat timeStep;\r
80 \r
81         PfxSetupJointConstraintsParam()\r
82         {\r
83                 timeStep = 0.016f;\r
84         }\r
85 };\r
86 \r
87 PfxInt32 pfxSetupJointConstraints(PfxSetupJointConstraintsParam &param);\r
88 \r
89 PfxInt32 pfxSetupJointConstraints(PfxSetupJointConstraintsParam &param,PfxTaskManager *taskManager);\r
90 \r
91 ///////////////////////////////////////////////////////////////////////////////\r
92 // Solve Constraints\r
93 \r
94 struct PfxSolveConstraintsParam {\r
95         void *workBuff;\r
96         PfxUInt32 workBytes;\r
97         PfxConstraintPair *contactPairs;\r
98         PfxUInt32 numContactPairs;\r
99         PfxContactManifold *offsetContactManifolds;\r
100         PfxConstraintPair *jointPairs;\r
101         PfxUInt32 numJointPairs;\r
102         PfxJoint *offsetJoints;\r
103         PfxRigidState *offsetRigidStates;\r
104         PfxSolverBody *offsetSolverBodies;\r
105         PfxUInt32 numRigidBodies;\r
106         PfxUInt32 iteration;\r
107         \r
108         PfxSolveConstraintsParam()\r
109         {\r
110                 iteration = 5;\r
111         }\r
112 };\r
113 \r
114 PfxUInt32 pfxGetWorkBytesOfSolveConstraints(PfxUInt32 numRigidBodies,PfxUInt32 numContactPairs,PfxUInt32 numJointPairs,PfxUInt32 maxTasks=1);\r
115 \r
116 PfxInt32 pfxSolveConstraints(PfxSolveConstraintsParam &param);\r
117 \r
118 PfxInt32 pfxSolveConstraints(PfxSolveConstraintsParam &param,PfxTaskManager *taskManager);\r
119 \r
120 } //namespace PhysicsEffects\r
121 } //namespace sce\r
122 #endif // _SCE_PFX_CONSTRAINT_SOLVER_H\r
123 \r