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