The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
5.1KB

  1. /*
  2. * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * 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
  9. * freely, subject to the following restrictions:
  10. * 1. The origin of this software must not be misrepresented; you must not
  11. * claim that you wrote the original software. If you use this software
  12. * in a product, an acknowledgment in the product documentation would be
  13. * appreciated but is not required.
  14. * 2. Altered source versions must be plainly marked as such, and must not be
  15. * misrepresented as being the original software.
  16. * 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifndef B2_SETTINGS_H
  19. #define B2_SETTINGS_H
  20. #define B2_NOT_USED(x) ((void)(x))
  21. #define b2Assert(A) jassert(A)
  22. typedef float float32;
  23. typedef double float64;
  24. #define b2_maxFloat FLT_MAX
  25. #define b2_epsilon FLT_EPSILON
  26. #define b2_pi 3.14159265359f
  27. /// @file
  28. /// Global tuning constants based on meters-kilograms-seconds (MKS) units.
  29. ///
  30. // Collision
  31. /// The maximum number of contact points between two convex shapes. Do
  32. /// not change this value.
  33. #define b2_maxManifoldPoints 2
  34. /// The maximum number of vertices on a convex polygon. You cannot increase
  35. /// this too much because b2BlockAllocator has a maximum object size.
  36. #define b2_maxPolygonVertices 8
  37. /// This is used to fatten AABBs in the dynamic tree. This allows proxies
  38. /// to move by a small amount without triggering a tree adjustment.
  39. /// This is in meters.
  40. #define b2_aabbExtension 0.1f
  41. /// This is used to fatten AABBs in the dynamic tree. This is used to predict
  42. /// the future position based on the current displacement.
  43. /// This is a dimensionless multiplier.
  44. #define b2_aabbMultiplier 2.0f
  45. /// A small length used as a collision and constraint tolerance. Usually it is
  46. /// chosen to be numerically significant, but visually insignificant.
  47. #define b2_linearSlop 0.005f
  48. /// A small angle used as a collision and constraint tolerance. Usually it is
  49. /// chosen to be numerically significant, but visually insignificant.
  50. #define b2_angularSlop (2.0f / 180.0f * b2_pi)
  51. /// The radius of the polygon/edge shape skin. This should not be modified. Making
  52. /// this smaller means polygons will have an insufficient buffer for continuous collision.
  53. /// Making it larger may create artifacts for vertex collision.
  54. #define b2_polygonRadius (2.0f * b2_linearSlop)
  55. /// Maximum number of sub-steps per contact in continuous physics simulation.
  56. #define b2_maxSubSteps 8
  57. // Dynamics
  58. /// Maximum number of contacts to be handled to solve a TOI impact.
  59. #define b2_maxTOIContacts 32
  60. /// A velocity threshold for elastic collisions. Any collision with a relative linear
  61. /// velocity below this threshold will be treated as inelastic.
  62. #define b2_velocityThreshold 1.0f
  63. /// The maximum linear position correction used when solving constraints. This helps to
  64. /// prevent overshoot.
  65. #define b2_maxLinearCorrection 0.2f
  66. /// The maximum angular position correction used when solving constraints. This helps to
  67. /// prevent overshoot.
  68. #define b2_maxAngularCorrection (8.0f / 180.0f * b2_pi)
  69. /// The maximum linear velocity of a body. This limit is very large and is used
  70. /// to prevent numerical problems. You shouldn't need to adjust this.
  71. #define b2_maxTranslation 2.0f
  72. #define b2_maxTranslationSquared (b2_maxTranslation * b2_maxTranslation)
  73. /// The maximum angular velocity of a body. This limit is very large and is used
  74. /// to prevent numerical problems. You shouldn't need to adjust this.
  75. #define b2_maxRotation (0.5f * b2_pi)
  76. #define b2_maxRotationSquared (b2_maxRotation * b2_maxRotation)
  77. /// This scale factor controls how fast overlap is resolved. Ideally this would be 1 so
  78. /// that overlap is removed in one time step. However using values close to 1 often lead
  79. /// to overshoot.
  80. #define b2_baumgarte 0.2f
  81. #define b2_toiBaugarte 0.75f
  82. // Sleep
  83. /// The time that a body must be still before it will go to sleep.
  84. #define b2_timeToSleep 0.5f
  85. /// A body cannot sleep if its linear velocity is above this tolerance.
  86. #define b2_linearSleepTolerance 0.01f
  87. /// A body cannot sleep if its angular velocity is above this tolerance.
  88. #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi)
  89. // Memory Allocation
  90. /// Implement this function to use your own memory allocator.
  91. void* b2Alloc(juce::int32 size);
  92. /// If you implement b2Alloc, you should also implement this function.
  93. void b2Free(void* mem);
  94. /// Logging function.
  95. void b2Log(const char* string, ...);
  96. /// Version numbering scheme.
  97. /// See http://en.wikipedia.org/wiki/Software_versioning
  98. struct b2Version
  99. {
  100. juce::int32 major; ///< significant changes
  101. juce::int32 minor; ///< incremental changes
  102. juce::int32 revision; ///< bug fixes
  103. };
  104. /// Current version.
  105. extern b2Version b2_version;
  106. #endif