Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
2.9 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MDLLIB_STRIPINFO_H
  7. #define MDLLIB_STRIPINFO_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "mdllib/mdllib.h"
  12. #include "mdllib_utils.h"
  13. #include "UtlSortVector.h"
  14. //
  15. // CMdlStripInfo
  16. // Implementation of IMdlStripInfo interface
  17. //
  18. class CMdlStripInfo : public IMdlStripInfo
  19. {
  20. public:
  21. CMdlStripInfo();
  22. //
  23. // Serialization
  24. //
  25. public:
  26. // Save the strip info to the buffer (appends to the end)
  27. virtual bool Serialize( CUtlBuffer &bufStorage ) const;
  28. // Load the strip info from the buffer (reads from the current position as much as needed)
  29. virtual bool UnSerialize( CUtlBuffer &bufData );
  30. //
  31. // Stripping info state
  32. //
  33. public:
  34. // Returns the checksums that the stripping info was generated for:
  35. // plChecksumOriginal if non-NULL will hold the checksum of the original model submitted for stripping
  36. // plChecksumStripped if non-NULL will hold the resulting checksum of the stripped model
  37. virtual bool GetCheckSum( long *plChecksumOriginal, long *plChecksumStripped ) const;
  38. //
  39. // Stripping
  40. //
  41. public:
  42. //
  43. // StripHardwareVertsBuffer
  44. // The main function that strips the vhv buffer
  45. // vhvBuffer - vhv buffer, updated, size reduced
  46. //
  47. virtual bool StripHardwareVertsBuffer( CUtlBuffer &vhvBuffer );
  48. //
  49. // StripModelBuffer
  50. // The main function that strips the mdl buffer
  51. // mdlBuffer - mdl buffer, updated
  52. //
  53. virtual bool StripModelBuffer( CUtlBuffer &mdlBuffer );
  54. //
  55. // StripVertexDataBuffer
  56. // The main function that strips the vvd buffer
  57. // vvdBuffer - vvd buffer, updated, size reduced
  58. //
  59. virtual bool StripVertexDataBuffer( CUtlBuffer &vvdBuffer );
  60. //
  61. // StripOptimizedModelBuffer
  62. // The main function that strips the vtx buffer
  63. // vtxBuffer - vtx buffer, updated, size reduced
  64. //
  65. virtual bool StripOptimizedModelBuffer( CUtlBuffer &vtxBuffer );
  66. //
  67. // Release the object with "delete this"
  68. //
  69. public:
  70. virtual void DeleteThis();
  71. public:
  72. void Reset();
  73. public:
  74. enum Mode
  75. {
  76. MODE_UNINITIALIZED = 0,
  77. MODE_NO_CHANGE = 1,
  78. MODE_STRIP_LOD_1N = 2,
  79. };
  80. //
  81. // Internal data used for stripping
  82. //
  83. public:
  84. int m_eMode;
  85. long m_lChecksumOld, m_lChecksumNew;
  86. CGrowableBitVec m_vtxVerts;
  87. CUtlSortVector< unsigned short, CLessSimple< unsigned short > > m_vtxIndices;
  88. //
  89. // Mesh ranges fixup
  90. //
  91. public:
  92. struct MdlRangeItem
  93. {
  94. /* implicit */ MdlRangeItem( int offOld = 0, int numOld = 0, int offNew = 0, int numNew = 0 ) :
  95. m_offOld( offOld ), m_offNew( offNew ), m_numOld( numOld ), m_numNew( numNew ) {}
  96. int m_offOld, m_offNew;
  97. int m_numOld, m_numNew;
  98. bool operator < ( MdlRangeItem const &x ) const { return m_offNew < x.m_offNew; }
  99. };
  100. CUtlSortVector< CMdlStripInfo::MdlRangeItem, CLessSimple< CMdlStripInfo::MdlRangeItem > > m_vtxMdlOffsets;
  101. };
  102. #endif // #ifndef MDLLIB_STRIPINFO_H