hlodsave.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. *** 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 : Renegade / G *
  23. * *
  24. * $Archive:: /Commando/Code/Tools/max2w3d/hlodsave.h $*
  25. * *
  26. * $Author:: Greg_h $*
  27. * *
  28. * $Modtime:: 10/27/00 10:22a $*
  29. * *
  30. * $Revision:: 4 $*
  31. * *
  32. *---------------------------------------------------------------------------------------------*
  33. * Functions: *
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #ifndef HLODSAVE_H
  36. #define HLODSAVE_H
  37. #include "always.h"
  38. #include <Max.h>
  39. #include <stdio.h>
  40. #include "w3d_file.h"
  41. #include "progress.h"
  42. #include "chunkio.h"
  43. #include "meshcon.h"
  44. class INodeListClass;
  45. class MeshConnectionsClass;
  46. /**
  47. ** HLodSaveClass
  48. ** This object takes an array of mesh-connections objects and exports an LOD model
  49. ** constructed from them.
  50. */
  51. class HLodSaveClass
  52. {
  53. public:
  54. HLodSaveClass (MeshConnectionsClass **connections, int lod_count, TimeValue CurTime,
  55. char *name, const char *htree_name, Progress_Meter_Class &meter,
  56. INodeListClass *origin_list);
  57. ~HLodSaveClass (void);
  58. bool Save (ChunkSaveClass &csave);
  59. protected:
  60. /*
  61. ** class HLodArrayEntry hold the HLOD tree that we will save out in the Save() method.
  62. */
  63. class HLodArrayEntry
  64. {
  65. public:
  66. W3dHLodArrayHeaderStruct header;
  67. W3dHLodSubObjectStruct *sub_obj;
  68. int num_sub_objects;
  69. HLodArrayEntry (int num_sub_objs = 0)
  70. {
  71. sub_obj = NULL;
  72. num_sub_objects = 0;
  73. Allocate_Sub_Objects(num_sub_objs);
  74. }
  75. ~HLodArrayEntry (void)
  76. {
  77. if (sub_obj)
  78. {
  79. delete sub_obj;
  80. sub_obj = NULL;
  81. num_sub_objects = 0;
  82. }
  83. }
  84. bool Allocate_Sub_Objects (int num)
  85. {
  86. if (num <= 0) return false;
  87. num_sub_objects = 0;
  88. sub_obj = new W3dHLodSubObjectStruct[num];
  89. if (!sub_obj) return false;
  90. num_sub_objects = num;
  91. return true;
  92. }
  93. bool operator == (const HLodArrayEntry & that) { return false; }
  94. bool operator != (const HLodArrayEntry & that) { return !(*this == that); }
  95. };
  96. bool save_header (ChunkSaveClass &csave);
  97. bool save_lod_arrays (ChunkSaveClass &csave);
  98. bool save_aggregate_array (ChunkSaveClass & csave);
  99. bool save_proxy_array(ChunkSaveClass & csave);
  100. bool save_sub_object_array(ChunkSaveClass & csave, const HLodArrayEntry & array);
  101. W3dHLodHeaderStruct header;
  102. HLodArrayEntry * lod_array;
  103. HLodArrayEntry aggregate_array;
  104. HLodArrayEntry proxy_array;
  105. };
  106. #endif