shattersystem.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. /***********************************************************************************************
  19. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : WWPhys *
  23. * *
  24. * $Archive:: /Commando/Code/ww3d2/shattersystem.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 1/08/01 10:04a $*
  31. * *
  32. * $Revision:: 1 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #if defined(_MSC_VER)
  38. #pragma once
  39. #endif
  40. #ifndef SHATTERSYSTEM_H
  41. #define SHATTERSYSTEM_H
  42. #include "always.h"
  43. class MeshClass;
  44. class PhysicsSceneClass;
  45. class RenderObjClass;
  46. class Vector3;
  47. class Matrix3D;
  48. class MeshMtlParamsClass;
  49. /**
  50. ** ShatterSystem
  51. ** This collection of static functions is used to "shatter" a mesh into fragments and
  52. ** create projectile objects which use the generated fragments as their render object.
  53. */
  54. class ShatterSystem
  55. {
  56. public:
  57. /*
  58. ** Init and Shutdown, these are called from the main physics system init and
  59. ** shutdown. The BSP shatter planes are loaded up and initialized in Init
  60. ** and released in Shutdown.
  61. */
  62. static void Init(void);
  63. static void Shutdown(void);
  64. /*
  65. ** Pass in the mesh you want shattered and the scene that you want
  66. ** the shards to be placed in.
  67. */
  68. static void Shatter_Mesh(MeshClass * mesh,const Vector3 & point,const Vector3 & velocity);
  69. /*
  70. ** Use these methods to get access to the resultant mesh fragments
  71. ** Get_Fragment_Count - returns the number of meshes created
  72. ** Get_Fragment - returns a pointer (ref-counted!) to the 'n'th mesh
  73. ** Relese_Fragments - call this when you are done, it causes the ShatterSystem
  74. ** to release its references to the fragments.
  75. */
  76. static int Get_Fragment_Count(void);
  77. static RenderObjClass * Get_Fragment(int fragment_index);
  78. static RenderObjClass * Peek_Fragment(int fragment_index);
  79. static void Release_Fragments(void);
  80. protected:
  81. static void Reset_Clip_Pools(void);
  82. static void Process_Clip_Pools(const Matrix3D &Mshatter_to_mesh,MeshClass * mesh,MeshMtlParamsClass & mtl_params);
  83. };
  84. #endif