physcon.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. ** Command & Conquer Renegade(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /Commando/Code/wwphys/physcon.h 11 9/20/01 5:12p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando *
  24. * *
  25. * $Archive:: /Commando/Code/wwphys/physcon.h $*
  26. * *
  27. * Author:: Greg_h *
  28. * *
  29. * $Modtime:: 9/19/01 7:49p $*
  30. * *
  31. * $Revision:: 11 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #if defined(_MSC_VER)
  37. #pragma once
  38. #endif
  39. #ifndef PHYSCON_H
  40. #define PHYSCON_H
  41. #include "always.h"
  42. #include "vector3.h"
  43. class ChunkLoadClass;
  44. class ChunkSaveClass;
  45. /**
  46. ** PhysicsConstants
  47. ** This is just a collection of global variables used by the physics simulation
  48. */
  49. class PhysicsConstants
  50. {
  51. public:
  52. /*
  53. ** One-Time initialization. This is called from WWPhys::Init automatically. Some of the
  54. ** constants are filled in with default values in this function.
  55. */
  56. static void Init(void);
  57. /*
  58. ** In this engine friction usually occurs between a moving object and
  59. ** polygons in the static terrain.
  60. */
  61. enum
  62. {
  63. DYNAMIC_OBJ_TYPE_TIRE = 0, // (tires on humvees, etc)
  64. DYNAMIC_OBJ_TYPE_TRACK, // (tracks on tanks, APCs, etc)
  65. DYNAMIC_OBJ_TYPE_GENERIC, // (generic dynamic objects, may need to expand this one)
  66. DYNAMIC_OBJ_TYPE_MAX,
  67. };
  68. /*
  69. ** Friction coefficients for various objects on various surface types
  70. */
  71. static void Set_Contact_Friction_Coefficient(int obj_type,int surface_type,float friction);
  72. static float Get_Contact_Friction_Coefficient(int obj_type,int surface_type);
  73. static void Set_Contact_Drag_Coefficient(int obj_type,int surface_type,float drag);
  74. static float Get_Contact_Drag_Coefficient(int obj_type,int surface_type);
  75. static void Set_Override_Surface_Type(int type);
  76. static void Set_Override_Surface_Friction(float friction);
  77. static void Set_Override_Surface_Drag(float drag);
  78. /*
  79. ** Save/Load support.
  80. */
  81. static void Save(ChunkSaveClass & csave);
  82. static void Load(ChunkLoadClass & cload);
  83. public:
  84. /*
  85. ** Accleration of gravity
  86. */
  87. static Vector3 GravityAcceleration;
  88. /*
  89. ** Linear Damping factor.
  90. */
  91. static float LinearDamping;
  92. /*
  93. ** Angular Damping factor.
  94. */
  95. static float AngularDamping;
  96. /*
  97. ** epsilon for detecting resting contact. If the
  98. ** velocity is within this epsilon of zero, a
  99. ** point is considered to be in resting contact.
  100. */
  101. static float RestingContactVelocity;
  102. /*
  103. ** Square of the minimum velocity a point must
  104. ** have before applying a dynamic friction to it.
  105. */
  106. static float MinFrictionVelocity;
  107. static float MinFrictionVelocity2;
  108. /*
  109. ** Default values for contact friction and drag
  110. */
  111. static float DefaultContactFriction;
  112. static float DefaultContactDrag;
  113. /*
  114. ** For debugging you can globally override the surface type
  115. */
  116. static int SurfaceTypeOverride;
  117. static float OverrideFriction;
  118. static float OverrideDrag;
  119. };
  120. #endif PHYSCON_H