2
0

dynamicanimphys.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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/wwphys/dynamicanimphys.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 11/01/01 2:23p $*
  31. * *
  32. * $Revision:: 8 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #ifndef DYANMICANIMPHYS_H
  38. #define DYNAMICANIMPHYS_H
  39. #include "always.h"
  40. #include "decophys.h"
  41. #include "animcollisionmanager.h"
  42. #include "dynamicshadowmanager.h"
  43. class ChunkLoadClass;
  44. class ChunkSaveClass;
  45. class DynamicAnimPhysDefClass;
  46. /**
  47. ** DynamicAnimPhysClass
  48. ** This class manages dynamic animations. These are similar to static anims but they can
  49. ** be dynamically created and destroyed and their bounding boxes can be animated (since they
  50. ** are placed into the dynamic culling system. However, since they are dynamic objects,
  51. ** they do not VIS or cull as accurately. An example of a dynamic animation would be an
  52. ** animated plane that flys across the level while an example of a static animation would
  53. ** be an animating elevator.
  54. */
  55. class DynamicAnimPhysClass : public DecorationPhysClass
  56. {
  57. public:
  58. DynamicAnimPhysClass(void);
  59. virtual ~DynamicAnimPhysClass(void);
  60. virtual DynamicAnimPhysClass * As_DynamicAnimPhysClass(void) { return this; }
  61. const DynamicAnimPhysDefClass * Get_DynamicAnimPhysDef(void);
  62. void Init(const DynamicAnimPhysDefClass & def);
  63. virtual void Set_Model(RenderObjClass * model);
  64. virtual bool Needs_Timestep(void) { return true; }
  65. virtual void Timestep(float dt);
  66. virtual void Post_Timestep_Process(void);
  67. /*
  68. ** State Import/Export and Save/Load
  69. */
  70. virtual bool Has_Dynamic_State(void) { return true; }
  71. /*
  72. ** save-load system
  73. */
  74. virtual const PersistFactoryClass & Get_Factory (void) const;
  75. virtual bool Save (ChunkSaveClass &csave);
  76. virtual bool Load (ChunkLoadClass &cload);
  77. virtual void On_Post_Load(void);
  78. /*
  79. ** Animation and animated collision control
  80. */
  81. AnimCollisionManagerClass & Get_Animation_Manager(void) { return AnimManager; }
  82. protected:
  83. void Update_Cached_Model_Parameters(void);
  84. void Reset_Mappers(RenderObjClass * model);
  85. AnimCollisionManagerClass AnimManager;
  86. DynamicShadowManagerClass ShadowManager;
  87. private:
  88. // Not implemented...
  89. DynamicAnimPhysClass(const DynamicAnimPhysClass &);
  90. DynamicAnimPhysClass & operator = (const DynamicAnimPhysClass &);
  91. };
  92. /**
  93. ** DynamicAnimPhysDefClass
  94. ** Definition data structure for DynamicAnimPhysClass
  95. */
  96. class DynamicAnimPhysDefClass : public DecorationPhysDefClass
  97. {
  98. public:
  99. DynamicAnimPhysDefClass(void);
  100. // From DefinitionClass
  101. virtual uint32 Get_Class_ID (void) const;
  102. virtual PersistClass * Create(void) const;
  103. // From PhysDefClass
  104. virtual const char * Get_Type_Name(void);
  105. virtual bool Is_Type(const char *);
  106. // From PersistClass
  107. virtual const PersistFactoryClass & Get_Factory (void) const;
  108. virtual bool Save(ChunkSaveClass &csave);
  109. virtual bool Load(ChunkLoadClass &cload);
  110. // Editable interface requirements
  111. DECLARE_EDITABLE(DynamicAnimPhysDefClass,DecorationPhysDefClass);
  112. protected:
  113. // Animation and animated collision support
  114. AnimCollisionManagerDefClass AnimManagerDef;
  115. bool CastsShadows;
  116. float ShadowNearZ;
  117. float ShadowFarZ;
  118. friend class DynamicAnimPhysClass;
  119. };
  120. /*
  121. ** Inlines
  122. */
  123. inline const DynamicAnimPhysDefClass * DynamicAnimPhysClass::Get_DynamicAnimPhysDef(void)
  124. {
  125. return (DynamicAnimPhysDefClass *)Definition;
  126. }
  127. #endif //DYNAMICANIMPHYS_H