1 | /* |
---|
2 | Bullet Continuous Collision Detection and Physics Library |
---|
3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
4 | |
---|
5 | This software is provided 'as-is', without any express or implied warranty. |
---|
6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
7 | Permission is granted to anyone to use this software for any purpose, |
---|
8 | including commercial applications, and to alter it and redistribute it freely, |
---|
9 | subject to the following restrictions: |
---|
10 | |
---|
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_CONTACT_SOLVER_INFO |
---|
17 | #define BT_CONTACT_SOLVER_INFO |
---|
18 | |
---|
19 | enum btSolverMode |
---|
20 | { |
---|
21 | SOLVER_RANDMIZE_ORDER = 1, |
---|
22 | SOLVER_FRICTION_SEPARATE = 2, |
---|
23 | SOLVER_USE_WARMSTARTING = 4, |
---|
24 | SOLVER_USE_FRICTION_WARMSTARTING = 8, |
---|
25 | SOLVER_USE_2_FRICTION_DIRECTIONS = 16, |
---|
26 | SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32, |
---|
27 | SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64, |
---|
28 | SOLVER_CACHE_FRIENDLY = 128, |
---|
29 | SOLVER_SIMD = 256, //enabled for Windows, the solver innerloop is branchless SIMD, 40% faster than FPU/scalar version |
---|
30 | SOLVER_CUDA = 512 //will be open sourced during Game Developers Conference 2009. Much faster. |
---|
31 | }; |
---|
32 | |
---|
33 | struct btContactSolverInfoData |
---|
34 | { |
---|
35 | |
---|
36 | |
---|
37 | btScalar m_tau; |
---|
38 | btScalar m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'. |
---|
39 | btScalar m_friction; |
---|
40 | btScalar m_timeStep; |
---|
41 | btScalar m_restitution; |
---|
42 | int m_numIterations; |
---|
43 | btScalar m_maxErrorReduction; |
---|
44 | btScalar m_sor; |
---|
45 | btScalar m_erp;//used as Baumgarte factor |
---|
46 | btScalar m_erp2;//used in Split Impulse |
---|
47 | btScalar m_globalCfm;//constraint force mixing |
---|
48 | int m_splitImpulse; |
---|
49 | btScalar m_splitImpulsePenetrationThreshold; |
---|
50 | btScalar m_linearSlop; |
---|
51 | btScalar m_warmstartingFactor; |
---|
52 | |
---|
53 | int m_solverMode; |
---|
54 | int m_restingContactRestitutionThreshold; |
---|
55 | int m_minimumSolverBatchSize; |
---|
56 | |
---|
57 | |
---|
58 | }; |
---|
59 | |
---|
60 | struct btContactSolverInfo : public btContactSolverInfoData |
---|
61 | { |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | inline btContactSolverInfo() |
---|
66 | { |
---|
67 | m_tau = btScalar(0.6); |
---|
68 | m_damping = btScalar(1.0); |
---|
69 | m_friction = btScalar(0.3); |
---|
70 | m_restitution = btScalar(0.); |
---|
71 | m_maxErrorReduction = btScalar(20.); |
---|
72 | m_numIterations = 10; |
---|
73 | m_erp = btScalar(0.2); |
---|
74 | m_erp2 = btScalar(0.1); |
---|
75 | m_globalCfm = btScalar(0.); |
---|
76 | m_sor = btScalar(1.); |
---|
77 | m_splitImpulse = false; |
---|
78 | m_splitImpulsePenetrationThreshold = -0.02f; |
---|
79 | m_linearSlop = btScalar(0.0); |
---|
80 | m_warmstartingFactor=btScalar(0.85); |
---|
81 | m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SOLVER_RANDMIZE_ORDER; |
---|
82 | m_restingContactRestitutionThreshold = 2;//resting contact lifetime threshold to disable restitution |
---|
83 | m_minimumSolverBatchSize = 128; //try to combine islands until the amount of constraints reaches this limit |
---|
84 | } |
---|
85 | }; |
---|
86 | |
---|
87 | #endif //BT_CONTACT_SOLVER_INFO |
---|