| 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 CONTACT_SOLVER_INFO |
|---|
| 17 | #define 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; |
|---|
| 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 | |
|---|
| 56 | |
|---|
| 57 | }; |
|---|
| 58 | |
|---|
| 59 | struct btContactSolverInfo : public btContactSolverInfoData |
|---|
| 60 | { |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | |
|---|
| 64 | inline btContactSolverInfo() |
|---|
| 65 | { |
|---|
| 66 | m_tau = btScalar(0.6); |
|---|
| 67 | m_damping = btScalar(1.0); |
|---|
| 68 | m_friction = btScalar(0.3); |
|---|
| 69 | m_restitution = btScalar(0.); |
|---|
| 70 | m_maxErrorReduction = btScalar(20.); |
|---|
| 71 | m_numIterations = 10; |
|---|
| 72 | m_erp = btScalar(0.2); |
|---|
| 73 | m_erp2 = btScalar(0.1); |
|---|
| 74 | m_globalCfm = btScalar(0.); |
|---|
| 75 | m_sor = btScalar(1.); |
|---|
| 76 | m_splitImpulse = false; |
|---|
| 77 | m_splitImpulsePenetrationThreshold = -0.02f; |
|---|
| 78 | m_linearSlop = btScalar(0.0); |
|---|
| 79 | m_warmstartingFactor=btScalar(0.85); |
|---|
| 80 | m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD ;//SOLVER_RANDMIZE_ORDER |
|---|
| 81 | m_restingContactRestitutionThreshold = 2;//resting contact lifetime threshold to disable restitution |
|---|
| 82 | } |
|---|
| 83 | }; |
|---|
| 84 | |
|---|
| 85 | #endif //CONTACT_SOLVER_INFO |
|---|