Counter Strike : Global Offensive Source Code
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.

179 lines
6.9 KiB

  1. //========= Copyright � 1996-2012, Valve Corporation, All rights reserved. ============//
  2. #ifndef CONSTANTS_HDR
  3. #define CONSTANTS_HDR
  4. #include "tier0/basetypes.h"
  5. #include "resourcefile/resourcestream.h"
  6. //! Global tuning constants based on meter-kilogram-seconds (MKS) units. Here adjusted
  7. //! to inches for Source2 (1 inch ~ 2.5 cm <=> 1 cm ~ 0.4 inch <=> 1 m ~ 40 inch)
  8. //---------------------------------------------------------------------------------------
  9. // General
  10. //---------------------------------------------------------------------------------------
  11. //! A small distance used as collision detection and dynamics tolerance. It is chosen
  12. //! to be numerically significant, but visually insignificant.
  13. //! (This is 1/32 of an inch)
  14. #define LINEAR_SLOP 0.03125f
  15. //! A small angle used a collision detection and dynamics tolerance. It is chosen
  16. //! to be numerically significant, but visually insignificant.
  17. #define ANGULAR_SLOP (2.0f / 180.0f * M_PI)
  18. //---------------------------------------------------------------------------------------
  19. // Convex hulls
  20. //---------------------------------------------------------------------------------------
  21. //! The *desired* maximum number of vertices on a convex hull. The number of vertices is
  22. //! chosen such that quadric shapes (e.g. cylinder and cones) can be approximated smoothly.
  23. //! Do not change this value!
  24. #define DESIRED_HULL_VERTICES 32
  25. //! Maximum number of vertices supported at runtime on a convex hull.
  26. //! Do not change this value!
  27. #define MAX_HULL_VERTICES 256
  28. //! Maximum number of half-edges supported at runtime on a convex hull.
  29. //! Do not change this value!
  30. #define MAX_HULL_HALFEDGES 256
  31. //! Maximum number of faces supported at runtime on a convex hull.
  32. //! Do not change this value!
  33. #define MAX_HULL_FACES 256
  34. //! The relative weld tolerance when pre-processing hull vertices.
  35. //! This value is dimensionless!
  36. #define RELATIVE_WELD_TOLERANCE 0.01f
  37. //---------------------------------------------------------------------------------------
  38. // Broadphase
  39. //---------------------------------------------------------------------------------------
  40. //! The maximum stack depth for iterative tree traversals.
  41. #define STACK_SIZE 64
  42. //! Constant to indicate an invalid proxy identifier
  43. #define NULL_PROXY -1
  44. //! The initial node capacity of the dynamic tree
  45. #define INITIAL_NODE_CAPACITY 32
  46. //! This is used to fatten AABBs in the dynamic tree. This allows proxies
  47. //! to move by a small amount without triggering a tree adjustment.
  48. //! (This is 0.1 [m] in MKS)
  49. #define BOUNDS_EXTENSION 4.0f
  50. //! This is used to fatten AABBs in the dynamic tree. This is used to predict
  51. //! the future position based on the current displacement.
  52. //! (This is a dimensionless multiplier)
  53. #define BOUNDS_MULTIPLIER 2.0f
  54. //---------------------------------------------------------------------------------------
  55. // Collision
  56. //---------------------------------------------------------------------------------------
  57. //! The maximum number of contact points between two touching shapes. Do not change this value!
  58. #define MAX_CONTACT_POINTS 4
  59. //! The number of buckets used in the mesh SAH builder
  60. #define SAH_BUILDER_BUCKET_COUNT 32
  61. //! The desired number of triangles in a leaf node of the mesh BVH
  62. #define DESIRED_TRIANGLES_PER_LEAF 4
  63. //! The maximum number of triangles in a leaf node of the mesh BVH
  64. #define MAXIMUM_TRIANGLES_PER_LEAF 8
  65. //! The maximum number of iteration of the TOI root finder
  66. #define MAX_ROOT_FINDER_ITERATIONS 64
  67. //! The radius of the hull/mesh shape skin. This should not be modified. Making
  68. //! this smaller means polytopes will have an insufficient buffer for continuous
  69. //! collision. Making it larger may create artifacts for vertex collision.
  70. #define CONVEX_RADIUS (2.0f * LINEAR_SLOP)
  71. //! The maximum number of sub-steps per contact in a continuous physics simulation.
  72. #define MAX_SUBSTEPS 4
  73. //---------------------------------------------------------------------------------------
  74. // Dynamics
  75. //---------------------------------------------------------------------------------------
  76. //! Define default solver position iterations.
  77. #define DEFAULT_POSITION_ITERATIONS 2
  78. //! Define default solver velocity iterations.
  79. #define DEFAULT_VELOCITY_ITERATIONS 8
  80. //! Define default gravity.
  81. //! (This is 9 [m/s^2] in MKS)
  82. #define DEFAULT_GRAVITY 360.0f
  83. //! Default air density, taken from CDragController
  84. #define DEFAULT_AIR_DENSITY 2.0f;
  85. //! The maximum linear velocity of a body. This limit is very large and is used
  86. //! to prevent numerical problems. You shouldn't need to adjust this.
  87. #define MAX_TRANSLATION 80.0f
  88. //! The maximum angular velocity of a body. This limit is very large and is used
  89. //! to prevent numerical problems. You shouldn't need to adjust this.
  90. #define MAX_ROTATION (0.25f * M_PI)
  91. //! A velocity threshold for elastic collisions. Any collision with a relative linear
  92. //! velocity below this threshold will be treated as inelastic.
  93. //! (This is 1 [m/s] in MKS)
  94. #define VELOCITY_THRESHOLD 40.0f
  95. //! The maximum linear position correction used when solving constraints. This helps to
  96. //! prevent overshoot.
  97. //! (This is 0.2 [m] in MKS)
  98. #define MAX_LINEAR_CORRECTION 8.0f
  99. //! The maximum angular position correction used when solving constraints. This helps to
  100. //! prevent overshoot.
  101. #define MAX_ANGULAR_CORRECTION (8.0f / 180.0f * M_PI)
  102. //! A Baumgarte like factor when using projection for constraint stabilization. This only
  103. //! effects contacts and limits. We want to avoid overshooting so this value should be in
  104. //! range 0.1 - 0.2. Overshooting can result in loosing contacts and warm-starting information
  105. //! which has a bunch of negative side effects (e.g. jitter and bad friction).
  106. //! (This is a dimensionless multiplier)
  107. #define TOI_BAUMGARTE 0.75f
  108. #define POSITION_BAUMGARTE 0.2f
  109. //! Factor when using Baumgarte stabilization to stabilize velocity constraints. This will
  110. //! effect all joints and add momentum when enabled.
  111. //! (This is a dimensionless multiplier)
  112. #define VELOCITY_BAUMGARTE 0.1f
  113. //---------------------------------------------------------------------------------------
  114. // Sleeping
  115. //---------------------------------------------------------------------------------------
  116. //! The time in seconds that a body must be still before it will go to sleep.
  117. #define TIME_TO_SLEEP 0.5f
  118. //! A body cannot sleep if its linear velocity is above this tolerance.
  119. //! (This is 0.01 [m/s] in MKS)
  120. #define LINEAR_SLEEP_TOLERANCE 0.4f
  121. //! A body cannot sleep if its angular velocity is above this tolerance.
  122. #define ANGULAR_SLEEP_TOLERANCE (2.0f / 180.0f * M_PI)
  123. //---------------------------------------------------------------------------------------
  124. // Default joint parameter
  125. //---------------------------------------------------------------------------------------
  126. #define DEFAULT_JOINT_CFM float( 0.0f )
  127. #define DEFAULT_JOINT_ERP float( 0.1f )
  128. // dummy schema data: workaround for a build dependency issue
  129. schema struct RnDummy_t
  130. {
  131. int32 m_nDummy;
  132. };
  133. #endif