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.
28 * The Half-Life MDL format is Valve's format for models in GoldSrc engine.
30 * These headers were added based on information found at
31 * https://github.com/malortie/assimp/wiki/MDL:-Half-Life-1-file-format
34 #define HLPOLYHEADER (('T' << 24) + ('S' << 16) + ('D' << 8) + 'I')
35 #define HLMDLHEADER "IDST"
36 #define HLSEQHEADER "IDSQ"
39 #define HLMDLFLAG_FLAT 0x1
40 #define HLMDLFLAG_CHROME 0x2
41 #define HLMDLFLAG_FULLBRIGHT 0x4
44 typedef struct dhlmdl_header_s
46 int32_t id; // Should be IDST
47 int32_t version; // Should be 10
58 int32_t num_bonecontrollers;
59 int32_t ofs_bonecontrollers;
67 int32_t num_seqgroups;
68 int32_t ofs_seqgroups;
72 int32_t ofs_texturedata;
75 int32_t num_skingroups;
78 int32_t num_bodyparts;
79 int32_t ofs_bodyparts;
81 int32_t num_attachments;
82 int32_t ofs_attachments;
87 int32_t num_soundgroups;
88 int32_t ofs_soundgroups;
90 int32_t num_transitions;
91 int32_t ofs_transitions;
94 typedef struct dhlmdl_sequence_header_s
96 int32_t id; // Should be IDSQ
97 int32_t version; // Should be 10
100 } dhlmdl_sequence_header_t;
102 typedef struct dhlmdl_texture_s
110 typedef struct dhlmdl_bone_s
115 int32_t bonecontroller[6];
120 typedef struct dhlmdl_bone_controller_s
128 } dhlmdl_bone_controller_t;
130 typedef struct dhlmdl_hitbox_s
137 typedef struct dhlmdl_sequence_group_s
142 } dhlmdl_sequence_group_t;
144 typedef struct dhlmdl_sequence_description_s
161 vec3_t linearmovement;
169 int32_t blendtype[2];
170 float blendstart[2], blendend[2];
171 int32_t unused2; // blendparent
176 int32_t unused3; // nextseq
177 } dhlmdl_sequence_description_t;
179 typedef uint16_t dhlmdl_animoffset_t[6];
181 typedef union dhlmdl_animvalue_s
188 } dhlmdl_animvalue_t;
190 typedef struct dhlmdl_animevent_s
196 } dhlmdl_animevent_t;
198 typedef struct dhlmdl_attachment_s
205 } dhlmdl_attachment_t;
207 typedef struct dhlmdl_bodypart_s
215 typedef struct dhlmdl_s
224 int32_t ofs_vertinfo;
228 int32_t ofs_norminfo;
234 typedef struct dhlmdl_mesh_s
242 typedef struct dhlmdl_trivert_s