MeshDeformUndo.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. ** Command & Conquer Generals(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. *** Confidential - Westwood Studios ***
  20. ***********************************************************************************************
  21. * *
  22. * Project Name : Commando / G 3D engine *
  23. * *
  24. * File Name : MeshDeformUndo.h *
  25. * *
  26. * Programmer : Patrick Smith *
  27. * *
  28. * Start Date : 06/08/99 *
  29. * *
  30. * Last Update :
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef __MESH_DEFORM_UNDO_H
  36. #define __MESH_DEFORM_UNDO_H
  37. #include <Max.H>
  38. #include "Vector.H"
  39. #include "MeshDeformDefs.H"
  40. // Forward declarations
  41. class MeshDeformClass;
  42. class MeshDeformModData;
  43. ///////////////////////////////////////////////////////////////////////////
  44. //
  45. // VertexRestoreClass
  46. //
  47. ///////////////////////////////////////////////////////////////////////////
  48. class VertexRestoreClass : public RestoreObj
  49. {
  50. public:
  51. //////////////////////////////////////////////////////////////////
  52. // Public constructors/destructor
  53. //////////////////////////////////////////////////////////////////
  54. VertexRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
  55. virtual ~VertexRestoreClass (void) { Free_Vertex_Array (); };
  56. //////////////////////////////////////////////////////////////////
  57. // RestoreObj overrides
  58. //////////////////////////////////////////////////////////////////
  59. virtual void Restore (int is_undo);
  60. virtual void Redo (void);
  61. virtual int Size (void) { return (m_VertexList.Count () * sizeof (Point3) * 2) + sizeof (VertexRestoreClass); }
  62. virtual void EndHold (void);
  63. protected:
  64. //////////////////////////////////////////////////////////////////
  65. // Protected methods
  66. //////////////////////////////////////////////////////////////////
  67. virtual void Copy_Vertex_State (DEFORM_LIST &list) = 0;
  68. virtual void Apply_Vertex_Data (DEFORM_LIST &list) = 0;
  69. void Free_Vertex_Array (void);
  70. //////////////////////////////////////////////////////////////////
  71. // Protected member data
  72. //////////////////////////////////////////////////////////////////
  73. Mesh * m_pMesh;
  74. MeshDeformClass * m_pModifier;
  75. MeshDeformModData * m_pModData;
  76. DEFORM_LIST m_VertexList;
  77. DEFORM_LIST m_RedoVertexList;
  78. int m_SetIndex;
  79. int m_KeyframeIndex;
  80. };
  81. ///////////////////////////////////////////////////////////////////////////
  82. //
  83. // VertexPositionRestoreClass
  84. //
  85. ///////////////////////////////////////////////////////////////////////////
  86. class VertexPositionRestoreClass : public VertexRestoreClass
  87. {
  88. public:
  89. //////////////////////////////////////////////////////////////////
  90. // Public constructors/destructor
  91. //////////////////////////////////////////////////////////////////
  92. VertexPositionRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
  93. virtual ~VertexPositionRestoreClass (void) { };
  94. //////////////////////////////////////////////////////////////////
  95. // RestoreObj overrides
  96. //////////////////////////////////////////////////////////////////
  97. TSTR Description (void) { return TSTR(_T("Vertex Position")); }
  98. protected:
  99. //////////////////////////////////////////////////////////////////
  100. // Protected methods
  101. //////////////////////////////////////////////////////////////////
  102. virtual void Copy_Vertex_State (DEFORM_LIST &list);
  103. virtual void Apply_Vertex_Data (DEFORM_LIST &list);
  104. };
  105. ///////////////////////////////////////////////////////////////////////////
  106. //
  107. // VertexColorRestoreClass
  108. //
  109. ///////////////////////////////////////////////////////////////////////////
  110. class VertexColorRestoreClass : public VertexRestoreClass
  111. {
  112. public:
  113. //////////////////////////////////////////////////////////////////
  114. // Public constructors/destructor
  115. //////////////////////////////////////////////////////////////////
  116. VertexColorRestoreClass (Mesh *mesh, MeshDeformClass *modifier, MeshDeformModData *mod_data);
  117. virtual ~VertexColorRestoreClass (void) { };
  118. //////////////////////////////////////////////////////////////////
  119. // RestoreObj overrides
  120. //////////////////////////////////////////////////////////////////
  121. TSTR Description (void) { return TSTR(_T("Vertex Color")); }
  122. protected:
  123. //////////////////////////////////////////////////////////////////
  124. // Protected methods
  125. //////////////////////////////////////////////////////////////////
  126. virtual void Copy_Vertex_State (DEFORM_LIST &list);
  127. virtual void Apply_Vertex_Data (DEFORM_LIST &list);
  128. };
  129. #endif //__MESH_DEFORM_UNDO_H