MeshDeformSaveSet.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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/Tools/max2w3d/MeshDeformSaveSet.h 2 6/16/99 6:56p Patrick $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G 3D engine *
  24. * *
  25. * File Name : MeshDeformSaveSet.H
  26. * *
  27. * Programmer : Patrick Smith *
  28. * *
  29. * Start Date : 05/28/99 *
  30. * *
  31. * Last Update :
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef __MESH_DEFORM_SAVE_SET_H
  37. #define __MESH_DEFORM_SAVE_SET_H
  38. #include <Max.h>
  39. #include "Vector.H"
  40. // Forward declarations
  41. class ChunkSaveClass;
  42. ///////////////////////////////////////////////////////////////////////////
  43. //
  44. // MeshDeformSaveSetClass
  45. //
  46. ///////////////////////////////////////////////////////////////////////////
  47. class MeshDeformSaveSetClass
  48. {
  49. public:
  50. //////////////////////////////////////////////////////////////////////
  51. // Public friends
  52. //////////////////////////////////////////////////////////////////////
  53. friend class MeshDeformSaveClass;
  54. protected:
  55. protected:
  56. //////////////////////////////////////////////////////////////////////
  57. // Protected data types
  58. //////////////////////////////////////////////////////////////////////
  59. typedef struct _DEFORM_DATA
  60. {
  61. UINT vert_index;
  62. Point3 position;
  63. VertColor color;
  64. // Don't care, DynamicVectorClass needs these
  65. bool operator== (const _DEFORM_DATA &src) { return false; }
  66. bool operator!= (const _DEFORM_DATA &src) { return true; }
  67. } DEFORM_DATA;
  68. //////////////////////////////////////////////////////////////////////
  69. // Protected data types
  70. //////////////////////////////////////////////////////////////////////
  71. typedef struct
  72. {
  73. float state;
  74. DynamicVectorClass<DEFORM_DATA> deform_list;
  75. } KEYFRAME;
  76. public:
  77. //////////////////////////////////////////////////////////////////////
  78. // Public constructors/destructors
  79. //////////////////////////////////////////////////////////////////////
  80. MeshDeformSaveSetClass (void)
  81. : m_Flags (0),
  82. m_CurrentKeyFrame (NULL) { }
  83. ~MeshDeformSaveSetClass (void) { Reset (); }
  84. //////////////////////////////////////////////////////////////////////
  85. // Public methods
  86. //////////////////////////////////////////////////////////////////////
  87. // Keyframe managment
  88. void Begin_Keyframe (float state);
  89. void End_Keyframe (void);
  90. // Vertex managment
  91. void Add_Vert (UINT vert_index, const Point3 &position, const VertColor &color);
  92. // Misc
  93. void Reset (void);
  94. bool Is_Empty (void) const { return m_DeformData.Count () == 0; }
  95. // Flag support
  96. bool Get_Flag (unsigned int flag) const { return (m_Flags & flag) == flag; }
  97. void Set_Flag (unsigned int flag, bool value) { if (value) (m_Flags |= flag); else (m_Flags &= ~flag); }
  98. unsigned int Get_Flags (void) const { return m_Flags; }
  99. // Enumeration
  100. float Get_Deform_State (int key_frame) const { return m_DeformData[key_frame]->state; }
  101. int Get_Keyframe_Count (void) const { return m_DeformData.Count (); }
  102. int Get_Deform_Data_Count (int key_frame) const { return m_DeformData[key_frame]->deform_list.Count (); }
  103. DEFORM_DATA & Get_Deform_Data (int key_frame, int index) { return m_DeformData[key_frame]->deform_list[index]; }
  104. void Replace_Deform_Data (int keyframe_index, DynamicVectorClass<DEFORM_DATA> &list);
  105. private:
  106. //////////////////////////////////////////////////////////////////////
  107. // Private member data
  108. //////////////////////////////////////////////////////////////////////
  109. DynamicVectorClass<KEYFRAME *> m_DeformData;
  110. KEYFRAME * m_CurrentKeyFrame;
  111. unsigned int m_Flags;
  112. };
  113. #endif //__MESH_DEFORM_SAVE_SET_H