visoptprogress.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/visoptprogress.h $*
  25. * *
  26. * Original Author:: Greg Hjelstrom *
  27. * *
  28. * $Author:: Greg_h $*
  29. * *
  30. * $Modtime:: 7/07/00 7:44p $*
  31. * *
  32. * $Revision:: 1 $*
  33. * *
  34. *---------------------------------------------------------------------------------------------*
  35. * Functions: *
  36. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  37. #ifndef VISOPTPROGRESS_H
  38. #define VISOPTPROGRESS_H
  39. #include "always.h"
  40. /**
  41. ** VisOptProgressClass
  42. ** This class encapsulates the progress and final statistics for a vis optimization process.
  43. ** During the optimization process, an external thread can read the TotalOperations and
  44. ** CompletedOperations counters (using the accessor functions) to update a progress meter
  45. ** (in a separate thread). After the process is complete, the other statistics will be
  46. ** valid.
  47. **
  48. ** Note that the TotalOperations count is an upper estimate and the process may (will usually)
  49. ** complete before Completed_Operation_Count reaches it.
  50. */
  51. class VisOptProgressClass
  52. {
  53. public:
  54. VisOptProgressClass(void);
  55. /*
  56. ** Initialization and update
  57. */
  58. void Reset(int total_operation_count);
  59. void Increment_Completed_Operations(int count = 1) { CompletedOps += count; }
  60. /*
  61. ** Accessors
  62. */
  63. int Get_Total_Operation_Count(void) { return TotalOps; }
  64. int Get_Completed_Operation_Count(void) { return CompletedOps; }
  65. int Get_Initial_Bit_Count(void) { return InitialBitCount; }
  66. int Get_Final_Bit_Count(void) { return FinalBitCount; }
  67. int Get_Initial_Sector_Count(void) { return InitialSectorCount; }
  68. int Get_Final_Sector_Count(void) { return FinalSectorCount; }
  69. int Get_Initial_Object_Count(void) { return InitialObjectCount; }
  70. int Get_Final_Object_Count(void) { return FinalObjectCount; }
  71. int Get_Initial_Dynamic_Cell_Count(void) { return InitialDynamicCellCount; }
  72. int Get_Final_Dynamic_Cell_Count(void) { return FinalDynamicCellCount; }
  73. int Get_Dynamic_Cells_Removed(void) { return DynCellsRemoved; }
  74. int Get_Objects_Merged(void) { return ObjectsMerged; }
  75. int Get_Sectors_Merged(void) { return SectorsMerged; }
  76. int Get_Total_Bits_Removed(void) { return InitialBitCount - FinalBitCount; }
  77. /*
  78. ** Control
  79. */
  80. void Set_Initial_Bit_Count(int count) { InitialBitCount = count; }
  81. void Set_Final_Bit_Count(int count) { FinalBitCount = count; }
  82. void Set_Initial_Sector_Count(int count) { InitialSectorCount = count; }
  83. void Set_Final_Sector_Count(int count) { FinalSectorCount = count; }
  84. void Set_Initial_Object_Count(int count) { InitialObjectCount = count; }
  85. void Set_Final_Object_Count(int count) { FinalObjectCount = count; }
  86. void Set_Initial_Dynamic_Cell_Count(int count) { InitialDynamicCellCount = count; }
  87. void Set_Final_Dynamic_Cell_Count(int count) { FinalDynamicCellCount = count; }
  88. void Increment_Dynamic_Cells_Removed(int count=1){ DynCellsRemoved+=count; }
  89. void Increment_Objects_Merged(int count=1) { ObjectsMerged+=count; }
  90. void Increment_Sectors_Merged(int count=1) { SectorsMerged+=count; }
  91. protected:
  92. int TotalOps;
  93. int CompletedOps;
  94. int InitialBitCount; // Initial number of bits in the vis system
  95. int FinalBitCount; // Final number of bits in the vis system
  96. int InitialSectorCount; // Initial number of sectors
  97. int FinalSectorCount; // Final number of sectors
  98. int InitialObjectCount; // initial number of objects
  99. int FinalObjectCount; // Final number of objects
  100. int InitialDynamicCellCount; // Initial number of dynamic objects
  101. int FinalDynamicCellCount; // Final number of dynamic objects
  102. int DynCellsRemoved; // Number of dynamic object cells optimized away
  103. int ObjectsMerged; // Number of arbitrary vis objects merged
  104. int SectorsMerged; // Number of arbitrary vis sectors merged
  105. };
  106. #endif //VISOPTPROGRESS_H