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.

86 lines
2.0 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Hardware Verts
  4. //
  5. // Contains data purposely formatted for a dma copy into a D3D Vertex Buffer.
  6. // The file is divided into two partitions, the foremost contains the static
  7. // portion (header), the latter contains the streamable compliant portion.
  8. // The streamable component starts and ends on a sector (512) aligned boundary.
  9. // The header identifies the vertex format of the data and the atomic sizes of each component.
  10. // The hierarchial mesh is flattened for dma but the vertex counts are available
  11. // per mesh to transfer each mesh individually.
  12. //=============================================================================//
  13. #ifndef HARDWAREVERTS_H
  14. #define HARDWAREVERTS_H
  15. #ifdef _WIN32
  16. #pragma once
  17. #endif
  18. #include "datamap.h"
  19. // valve hardware vertexes
  20. #define VHV_VERSION 2
  21. namespace HardwareVerts
  22. {
  23. #pragma pack(1)
  24. struct MeshHeader_t
  25. {
  26. DECLARE_BYTESWAP_DATADESC();
  27. // this mesh is part of this lod
  28. unsigned int m_nLod;
  29. // this mesh has this many vertexes
  30. unsigned int m_nVertexes;
  31. // starting at this offset
  32. unsigned int m_nOffset;
  33. unsigned int m_nUnused[4];
  34. };
  35. struct FileHeader_t
  36. {
  37. DECLARE_BYTESWAP_DATADESC();
  38. // file version as defined by VHV_VERSION
  39. int m_nVersion;
  40. // must match checkSum in the .mdl header
  41. unsigned int m_nChecksum;
  42. // a vertex consists of these components
  43. uint32 m_nVertexFlags;
  44. // the byte size of a single vertex
  45. // this won't be adequate, need some concept of byte format i.e. rgbexp32 vs rgba8888
  46. unsigned int m_nVertexSize;
  47. // total number of vertexes
  48. unsigned int m_nVertexes;
  49. int m_nMeshes;
  50. inline MeshHeader_t *pMesh( int nMesh ) const
  51. {
  52. return (MeshHeader_t *)(((byte *)this) + sizeof(FileHeader_t)) + nMesh;
  53. };
  54. inline void *pVertexBase( int nMesh ) const
  55. {
  56. return (void *)((byte *)this + pMesh( nMesh )->m_nOffset);
  57. };
  58. unsigned int m_nUnused[4];
  59. };
  60. #pragma pack()
  61. }; // end namespace
  62. #endif // HARDWAREVERTS_H