2 Copyright (C) 2021 David Knapp (Cloudwalk)
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * The Half-Life MDL format is Valve's format for models in GoldSrc engine.
24 * These headers were added based on information found at
25 * https://github.com/malortie/assimp/wiki/MDL:-Half-Life-1-file-format
31 #define HLPOLYHEADER (('T' << 24) + ('S' << 16) + ('D' << 8) + 'I')
32 #define HLMDLHEADER "IDST"
33 #define HLSEQHEADER "IDSQ"
36 #define HLMDLFLAG_FLAT 0x1
37 #define HLMDLFLAG_CHROME 0x2
38 #define HLMDLFLAG_FULLBRIGHT 0x4
41 typedef struct dhlmdl_header_s
43 int32_t id; // Should be IDST
44 int32_t version; // Should be 10
55 int32_t num_bonecontrollers;
56 int32_t ofs_bonecontrollers;
64 int32_t num_seqgroups;
65 int32_t ofs_seqgroups;
69 int32_t ofs_texturedata;
72 int32_t num_skingroups;
75 int32_t num_bodyparts;
76 int32_t ofs_bodyparts;
78 int32_t num_attachments;
79 int32_t ofs_attachments;
84 int32_t num_soundgroups;
85 int32_t ofs_soundgroups;
87 int32_t num_transitions;
88 int32_t ofs_transitions;
91 typedef struct dhlmdl_sequence_header_s
93 int32_t id; // Should be IDSQ
94 int32_t version; // Should be 10
97 } dhlmdl_sequence_header_t;
99 typedef struct dhlmdl_texture_s
107 typedef struct dhlmdl_bone_s
112 int32_t bonecontroller[6];
117 typedef struct dhlmdl_bone_controller_s
125 } dhlmdl_bone_controller_t;
127 typedef struct dhlmdl_hitbox_s
134 typedef struct dhlmdl_sequence_group_s
139 } dhlmdl_sequence_group_t;
141 typedef struct dhlmdl_sequence_description_s
158 vec3_t linearmovement;
166 int32_t blendtype[2];
167 float blendstart[2], blendend[2];
168 int32_t unused2; // blendparent
173 int32_t unused3; // nextseq
174 } dhlmdl_sequence_description_t;
176 typedef uint16_t dhlmdl_animoffset_t[6];
178 typedef union dhlmdl_animvalue_s
185 } dhlmdl_animvalue_t;
187 typedef struct dhlmdl_animevent_s
193 } dhlmdl_animevent_t;
195 typedef struct dhlmdl_attachment_s
202 } dhlmdl_attachment_t;
204 typedef struct dhlmdl_bodypart_s
212 typedef struct dhlmdl_s
221 int32_t ofs_vertinfo;
225 int32_t ofs_norminfo;
231 typedef struct dhlmdl_mesh_s
239 typedef struct dhlmdl_trivert_s