Team Fortress 2 Source Code as on 22/4/2020
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.

44 lines
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef PERFORMANCE_H
  7. #define PERFORMANCE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. // Don't ever change these values, or face all kinds of subtle gameplay changes
  12. const float k_flMaxVelocity = 2000.0f;
  13. const float k_flMaxAngularVelocity = 360.0f * 10.0f;
  14. const float DEFAULT_MIN_FRICTION_MASS = 10.0f;
  15. const float DEFAULT_MAX_FRICTION_MASS = 2500.0f;
  16. struct physics_performanceparams_t
  17. {
  18. int maxCollisionsPerObjectPerTimestep; // object will be frozen after this many collisions (visual hitching vs. CPU cost)
  19. int maxCollisionChecksPerTimestep; // objects may penetrate after this many collision checks (can be extended in AdditionalCollisionChecksThisTick)
  20. float maxVelocity; // limit world space linear velocity to this (in / s)
  21. float maxAngularVelocity; // limit world space angular velocity to this (degrees / s)
  22. float lookAheadTimeObjectsVsWorld; // predict collisions this far (seconds) into the future
  23. float lookAheadTimeObjectsVsObject; // predict collisions this far (seconds) into the future
  24. float minFrictionMass; // min mass for friction solves (constrains dynamic range of mass to improve stability)
  25. float maxFrictionMass; // mas mass for friction solves
  26. void Defaults()
  27. {
  28. maxCollisionsPerObjectPerTimestep = 6;
  29. maxCollisionChecksPerTimestep = 250;
  30. maxVelocity = k_flMaxVelocity;
  31. maxAngularVelocity = k_flMaxAngularVelocity;
  32. lookAheadTimeObjectsVsWorld = 1.0f;
  33. lookAheadTimeObjectsVsObject = 0.5f;
  34. minFrictionMass = DEFAULT_MIN_FRICTION_MASS;
  35. maxFrictionMass = DEFAULT_MAX_FRICTION_MASS;
  36. }
  37. };
  38. #endif // PERFORMANCE_H