MeshDeform.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. /* $Header: /Commando/Code/Tools/max2w3d/MeshDeform.h 6 4/24/01 6:02p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G 3D engine *
  24. * *
  25. * File Name : MeshDeform.H *
  26. * *
  27. * Programmer : Patrick Smith *
  28. * *
  29. * Start Date : 04/19/99 *
  30. * *
  31. * Last Update :
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef __MESH_DEFORM_H
  37. #define __MESH_DEFORM_H
  38. #include <Max.h>
  39. #include "Vector.H"
  40. // Forward declarations
  41. class MeshDeformPanelClass;
  42. class MeshDeformModData;
  43. ///////////////////////////////////////////////////////////////////////////
  44. //
  45. // Prototypes
  46. //
  47. ///////////////////////////////////////////////////////////////////////////
  48. ClassDesc *Get_Mesh_Deform_Desc (void);
  49. extern Class_ID _MeshDeformClassID;
  50. ///////////////////////////////////////////////////////////////////////////
  51. //
  52. // MeshDeformClass
  53. //
  54. ///////////////////////////////////////////////////////////////////////////
  55. class MeshDeformClass : public OSModifier
  56. {
  57. public:
  58. //////////////////////////////////////////////////////////////////////
  59. // Public constructors/destructors
  60. //////////////////////////////////////////////////////////////////////
  61. MeshDeformClass (void)
  62. : m_MaxInterface (NULL),
  63. m_ModeMove (NULL),
  64. m_ModeSelect (NULL),
  65. m_ModeRotate (NULL),
  66. m_ModeUScale (NULL),
  67. m_ModeNUScale (NULL),
  68. m_ModeSquash (NULL),
  69. m_DeformState (1.0F),
  70. m_pPanel (NULL),
  71. m_CurrentSet (0),
  72. m_bSetDirty (true),
  73. m_VertColorChanging (false),
  74. m_MaxSets (0),
  75. m_hRollupWnd (NULL) { SetName ("WW Mesh Deformer"); Set_Max_Deform_Sets (1); }
  76. virtual ~MeshDeformClass (void) { }
  77. #if defined W3D_MAX4 //defined as in the project (.dsp)
  78. NumSubObjTypes();
  79. GetSubObjType();
  80. #endif
  81. //////////////////////////////////////////////////////////////////////
  82. // Public methods
  83. //////////////////////////////////////////////////////////////////////
  84. void Set_Deform_State (float state = 1.0F);
  85. float Get_Deform_State (void) const { return m_DeformState; }
  86. void Set_Vertex_Color (const Point3 &color, bool button_up);
  87. void Get_Vertex_Color (Point3 &color);
  88. void Set_Max_Deform_Sets (int max);
  89. int Get_Max_Deform_Sets (void) const { return m_MaxSets; }
  90. void Set_Current_Set (int index, bool update_selection);
  91. int Get_Current_Set (void) const { return m_CurrentSet; }
  92. void Update_UI (MeshDeformModData *mod_data);
  93. void Auto_Apply (bool auto_apply = true);
  94. //////////////////////////////////////////////////////////////////////
  95. // Base class overrides
  96. //////////////////////////////////////////////////////////////////////
  97. //////////////////////////////////////////////////////////////////////
  98. // From Animatable
  99. //////////////////////////////////////////////////////////////////////
  100. void DeleteThis (void) { delete this; }
  101. void GetClassName (TSTR& s) { s = TSTR(_T("WWDeform")); }
  102. TCHAR * GetObjectName (void) { return _T("WWDamage"); }
  103. SClass_ID SuperClassID (void) { return OSM_CLASS_ID; }
  104. Class_ID ClassID (void) { return _MeshDeformClassID; }
  105. //RefTargetHandle Clone(RemapDir& remap = NoRemap());
  106. void BeginEditParams (IObjParam *ip, ULONG flags,Animatable *prev);
  107. void EndEditParams (IObjParam *ip, ULONG flags,Animatable *next);
  108. //////////////////////////////////////////////////////////////////////
  109. // From Modifier
  110. //////////////////////////////////////////////////////////////////////
  111. ChannelMask ChannelsUsed (void);
  112. ChannelMask ChannelsChanged (void);
  113. void ModifyObject (TimeValue t, ModContext &mod_context, ObjectState* os, INode *node);
  114. BOOL DependOnTopology (ModContext &mod_context) { return TRUE; }
  115. int NeedUseSubselButton (void) { return TRUE; }
  116. Class_ID InputType (void);
  117. //////////////////////////////////////////////////////////////////////
  118. // From ReferenceMaker
  119. //////////////////////////////////////////////////////////////////////
  120. RefResult NotifyRefChanged (Interval time, RefTargetHandle htarget, PartID &part_id, RefMessage mesage);
  121. IOResult SaveLocalData (ISave *save_obj, LocalModData *mod_context);
  122. IOResult LoadLocalData (ILoad *load_obj, LocalModData **mod_context);
  123. //////////////////////////////////////////////////////////////////////
  124. // From BaseObject
  125. //////////////////////////////////////////////////////////////////////
  126. CreateMouseCallBack * GetCreateMouseCallBack (void);
  127. void ActivateSubobjSel (int level, XFormModes &modes);
  128. int HitTest (TimeValue time_value, INode * node, int type, int crossing, int flags, IPoint2 *point, ViewExp *viewport, ModContext *mod_context);
  129. void SelectSubComponent (HitRecord *hit_record, BOOL selected, BOOL all, BOOL invert);
  130. void GetSubObjectCenters (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc);
  131. void GetSubObjectTMs (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc);
  132. int SubObjectIndex (HitRecord *hitRec) { return hitRec->hitInfo; }
  133. void ClearSelection (int selLevel);
  134. // Transformation managment
  135. void Move (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &point, BOOL local_origin);
  136. void Rotate (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Quat &rotation, BOOL local_origin);
  137. void Scale (TimeValue time_val, Matrix3 &parent_tm, Matrix3 &tm_axis, Point3 &value, BOOL local_origin);
  138. void TransformStart (TimeValue time_val);
  139. void TransformFinish (TimeValue time_val);
  140. void TransformCancel (TimeValue time_val);
  141. #if defined W3D_MAX4 //defined as in the project (.dsp)
  142. ISubObjType * GetSubObjType(int i) ;
  143. #endif
  144. protected:
  145. //////////////////////////////////////////////////////////////////////
  146. // Protected methods
  147. //////////////////////////////////////////////////////////////////////
  148. void Update_Current_Set (void);
  149. void Update_Set_Count (void);
  150. private:
  151. //////////////////////////////////////////////////////////////////////
  152. // Private member data
  153. //////////////////////////////////////////////////////////////////////
  154. IObjParam * m_MaxInterface;
  155. HWND m_hRollupWnd;
  156. MeshDeformPanelClass * m_pPanel;
  157. float m_DeformState;
  158. bool m_VertColorChanging;
  159. // Mode handlers
  160. SelectModBoxCMode * m_ModeSelect;
  161. MoveModBoxCMode * m_ModeMove;
  162. RotateModBoxCMode * m_ModeRotate;
  163. UScaleModBoxCMode * m_ModeUScale;
  164. NUScaleModBoxCMode * m_ModeNUScale;
  165. SquashModBoxCMode * m_ModeSquash;
  166. // Set managment
  167. bool m_bSetDirty;
  168. int m_CurrentSet;
  169. int m_MaxSets;
  170. // Information
  171. CStr m_OperationName;
  172. };
  173. #endif //__MESH_DEFORM_H