Counter Strike : Global Offensive Source Code
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.

159 lines
4.0 KiB

  1. //====== Copyright � 1996-2007, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef MDLLIB_H
  7. #define MDLLIB_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier1/utlbuffer.h"
  12. #include "appframework/IAppSystem.h"
  13. //
  14. // Forward interface declarations
  15. //
  16. abstract_class IMdlLib;
  17. abstract_class IMdlStripInfo;
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Interface to accessing model data operations
  20. //-----------------------------------------------------------------------------
  21. namespace MdlLib
  22. {
  23. struct MdlVertex
  24. {
  25. float position[3];
  26. float normal[3];
  27. float texcoord[2];
  28. };
  29. struct MdlMesh
  30. {
  31. unsigned long checksum;
  32. CUtlVector< unsigned int > ib;
  33. CUtlVector< MdlVertex > vb;
  34. };
  35. };
  36. abstract_class IMdlLib : public IAppSystem
  37. {
  38. //
  39. // Stripping routines
  40. //
  41. public:
  42. //
  43. // StripModelBuffers
  44. // The main function that strips the model buffers
  45. // mdlBuffer - mdl buffer, updated, no size change
  46. // vvdBuffer - vvd buffer, updated, size reduced
  47. // vtxBuffer - vtx buffer, updated, size reduced
  48. // ppStripInfo - if nonzero on return will be filled with the stripping info
  49. //
  50. virtual bool StripModelBuffers( CUtlBuffer &mdlBuffer, CUtlBuffer &vvdBuffer, CUtlBuffer &vtxBuffer, IMdlStripInfo **ppStripInfo ) = 0;
  51. //
  52. // CreateNewStripInfo
  53. // Creates an empty strip info or resets an existing strip info so that it can be reused.
  54. //
  55. virtual bool CreateNewStripInfo( IMdlStripInfo **ppStripInfo ) = 0;
  56. //
  57. // ParseMdlMesh
  58. // The main function that parses the mesh buffers
  59. // mdlBuffer - mdl buffer
  60. // vvdBuffer - vvd buffer
  61. // vtxBuffer - vtx buffer
  62. // mesh - on return will be filled with the mesh info
  63. //
  64. virtual bool ParseMdlMesh( CUtlBuffer &mdlBuffer, CUtlBuffer &vvdBuffer, CUtlBuffer &vtxBuffer, MdlLib::MdlMesh &mesh ) = 0;
  65. //
  66. // PrepareModelForPs3
  67. // The main function that strips the model buffers
  68. // mdlBuffer - mdl buffer, updated, size possibly increased
  69. // vvdBuffer - vvd buffer, updated, size possibly increased
  70. // vtxBuffer - vtx buffer, updated, size possibly increased
  71. // ppStripInfo - if nonzero on return will be filled with the stripping info
  72. //
  73. virtual bool PrepareModelForPs3( CUtlBuffer &mdlBuffer, CUtlBuffer &vvdBuffer, CUtlBuffer &vtxBuffer, IMdlStripInfo **ppStripInfo ) = 0;
  74. };
  75. abstract_class IMdlStripInfo
  76. {
  77. //
  78. // Serialization
  79. //
  80. public:
  81. // Save the strip info to the buffer (appends to the end)
  82. virtual bool Serialize( CUtlBuffer &bufStorage ) const = 0;
  83. // Load the strip info from the buffer (reads from the current position as much as needed)
  84. virtual bool UnSerialize( CUtlBuffer &bufData ) = 0;
  85. //
  86. // Stripping info state
  87. //
  88. public:
  89. // Returns the checksums that the stripping info was generated for:
  90. // plChecksumOriginal if non-NULL will hold the checksum of the original model submitted for stripping
  91. // plChecksumStripped if non-NULL will hold the resulting checksum of the stripped model
  92. virtual bool GetCheckSum( long *plChecksumOriginal, long *plChecksumStripped ) const = 0;
  93. //
  94. // Stripping
  95. //
  96. public:
  97. //
  98. // StripHardwareVertsBuffer
  99. // The main function that strips the vhv buffer
  100. // vhvBuffer - vhv buffer, updated, size reduced
  101. //
  102. virtual bool StripHardwareVertsBuffer( CUtlBuffer &vhvBuffer ) = 0;
  103. //
  104. // StripModelBuffer
  105. // The main function that strips the mdl buffer
  106. // mdlBuffer - mdl buffer, updated
  107. //
  108. virtual bool StripModelBuffer( CUtlBuffer &mdlBuffer ) = 0;
  109. //
  110. // StripVertexDataBuffer
  111. // The main function that strips the vvd buffer
  112. // vvdBuffer - vvd buffer, updated, size reduced
  113. //
  114. virtual bool StripVertexDataBuffer( CUtlBuffer &vvdBuffer ) = 0;
  115. //
  116. // StripOptimizedModelBuffer
  117. // The main function that strips the vtx buffer
  118. // vtxBuffer - vtx buffer, updated, size reduced
  119. //
  120. virtual bool StripOptimizedModelBuffer( CUtlBuffer &vtxBuffer ) = 0;
  121. //
  122. // Release the object with "delete this"
  123. //
  124. public:
  125. virtual void DeleteThis() = 0;
  126. };
  127. #endif // MDLLIB_H