HalfLifeFileData.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /*
  2. Open Asset Import Library (ASSIMP)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2008, ASSIMP Development Team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the ASSIMP team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the ASSIMP Development Team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. //
  34. //! @file Definition of in-memory structures for the HL2 MDL file format
  35. // and for the HalfLife text format (SMD)
  36. //
  37. // The specification has been taken from various sources on the internet.
  38. #ifndef AI_MDLFILEHELPER2_H_INC
  39. #define AI_MDLFILEHELPER2_H_INC
  40. // ugly compiler dependent packing stuff
  41. #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
  42. # pragma pack(push,1)
  43. # define PACK_STRUCT
  44. #elif defined( __GNUC__ )
  45. # define PACK_STRUCT __attribute__((packed))
  46. #else
  47. # error Compiler not supported. Never do this again.
  48. #endif
  49. namespace Assimp
  50. {
  51. namespace MDL
  52. {
  53. // magic bytes used in Half Life 2 MDL models
  54. #define AI_MDL_MAGIC_NUMBER_BE_HL2a 'IDST'
  55. #define AI_MDL_MAGIC_NUMBER_LE_HL2a 'TSDI'
  56. #define AI_MDL_MAGIC_NUMBER_BE_HL2b 'IDSQ'
  57. #define AI_MDL_MAGIC_NUMBER_LE_HL2b 'QSDI'
  58. // ---------------------------------------------------------------------------
  59. /** \struct Header_HL2
  60. * \brief Data structure for the HL2 main header
  61. */
  62. // ---------------------------------------------------------------------------
  63. struct Header_HL2
  64. {
  65. //! magic number: "IDST"/"IDSQ"
  66. char ident[4];
  67. //! Version number
  68. int32_t version;
  69. //! Original file name in pak ?
  70. char name[64];
  71. //! Length of file name/length of file?
  72. int32_t length;
  73. //! For viewer, ignored
  74. aiVector3D eyeposition;
  75. aiVector3D min;
  76. aiVector3D max;
  77. //! AABB of the model
  78. aiVector3D bbmin;
  79. aiVector3D bbmax;
  80. // File flags
  81. int32_t flags;
  82. //! NUmber of bones contained in the file
  83. int32_t numbones;
  84. int32_t boneindex;
  85. //! Number of bone controllers for bone animation
  86. int32_t numbonecontrollers;
  87. int32_t bonecontrollerindex;
  88. //! More bounding boxes ...
  89. int32_t numhitboxes;
  90. int32_t hitboxindex;
  91. //! Animation sequences in the file
  92. int32_t numseq;
  93. int32_t seqindex;
  94. //! Loaded sequences. Ignored
  95. int32_t numseqgroups;
  96. int32_t seqgroupindex;
  97. //! Raw texture data
  98. int32_t numtextures;
  99. int32_t textureindex;
  100. int32_t texturedataindex;
  101. //! Number of skins (=textures?)
  102. int32_t numskinref;
  103. int32_t numskinfamilies;
  104. int32_t skinindex;
  105. //! Number of parts
  106. int32_t numbodyparts;
  107. int32_t bodypartindex;
  108. //! attachable points for gameplay and physics
  109. int32_t numattachments;
  110. int32_t attachmentindex;
  111. //! Table of sound effects associated with the model
  112. int32_t soundtable;
  113. int32_t soundindex;
  114. int32_t soundgroups;
  115. int32_t soundgroupindex;
  116. //! Number of animation transitions
  117. int32_t numtransitions;
  118. int32_t transitionindex;
  119. } PACK_STRUCT;
  120. // reset packing to the original value
  121. #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
  122. # pragma pack( pop )
  123. #endif
  124. #undef PACK_STRUCT
  125. };}; // end namespaces
  126. #endif // ! AI_MDLFILEHELPER2_H_INC