rev |
line source |
nuclear@0
|
1 /*
|
nuclear@0
|
2 Open Asset Import Library (assimp)
|
nuclear@0
|
3 ----------------------------------------------------------------------
|
nuclear@0
|
4
|
nuclear@0
|
5 Copyright (c) 2006-2012, assimp team
|
nuclear@0
|
6 All rights reserved.
|
nuclear@0
|
7
|
nuclear@0
|
8 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
9 with or without modification, are permitted provided that the
|
nuclear@0
|
10 following conditions are met:
|
nuclear@0
|
11
|
nuclear@0
|
12 * Redistributions of source code must retain the above
|
nuclear@0
|
13 copyright notice, this list of conditions and the
|
nuclear@0
|
14 following disclaimer.
|
nuclear@0
|
15
|
nuclear@0
|
16 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
17 copyright notice, this list of conditions and the
|
nuclear@0
|
18 following disclaimer in the documentation and/or other
|
nuclear@0
|
19 materials provided with the distribution.
|
nuclear@0
|
20
|
nuclear@0
|
21 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
22 contributors may be used to endorse or promote products
|
nuclear@0
|
23 derived from this software without specific prior
|
nuclear@0
|
24 written permission of the assimp team.
|
nuclear@0
|
25
|
nuclear@0
|
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
37
|
nuclear@0
|
38 ----------------------------------------------------------------------
|
nuclear@0
|
39 */
|
nuclear@0
|
40
|
nuclear@0
|
41
|
nuclear@0
|
42 /**
|
nuclear@0
|
43 * @file MDLFileData.h
|
nuclear@0
|
44 * @brief Definition of in-memory structures for the MDL file format.
|
nuclear@0
|
45 *
|
nuclear@0
|
46 * The specification has been taken from various sources on the internet.
|
nuclear@0
|
47 * - http://tfc.duke.free.fr/coding/mdl-specs-en.html
|
nuclear@0
|
48 * - Conitec's MED SDK
|
nuclear@0
|
49 * - Many quite long HEX-editor sessions
|
nuclear@0
|
50 */
|
nuclear@0
|
51
|
nuclear@0
|
52 #ifndef AI_MDLFILEHELPER_H_INC
|
nuclear@0
|
53 #define AI_MDLFILEHELPER_H_INC
|
nuclear@0
|
54
|
nuclear@0
|
55 #include "assimp/Compiler/pushpack1.h"
|
nuclear@0
|
56
|
nuclear@0
|
57 namespace Assimp {
|
nuclear@0
|
58 namespace MDL {
|
nuclear@0
|
59
|
nuclear@0
|
60 // -------------------------------------------------------------------------------------
|
nuclear@0
|
61 // to make it easier for us, we test the magic word against both "endianesses"
|
nuclear@0
|
62
|
nuclear@0
|
63 // magic bytes used in Quake 1 MDL meshes
|
nuclear@0
|
64 #define AI_MDL_MAGIC_NUMBER_BE AI_MAKE_MAGIC("IDPO")
|
nuclear@0
|
65 #define AI_MDL_MAGIC_NUMBER_LE AI_MAKE_MAGIC("OPDI")
|
nuclear@0
|
66
|
nuclear@0
|
67 // magic bytes used in GameStudio A<very low> MDL meshes
|
nuclear@0
|
68 #define AI_MDL_MAGIC_NUMBER_BE_GS3 AI_MAKE_MAGIC("MDL2")
|
nuclear@0
|
69 #define AI_MDL_MAGIC_NUMBER_LE_GS3 AI_MAKE_MAGIC("2LDM")
|
nuclear@0
|
70
|
nuclear@0
|
71 // magic bytes used in GameStudio A4 MDL meshes
|
nuclear@0
|
72 #define AI_MDL_MAGIC_NUMBER_BE_GS4 AI_MAKE_MAGIC("MDL3")
|
nuclear@0
|
73 #define AI_MDL_MAGIC_NUMBER_LE_GS4 AI_MAKE_MAGIC("3LDM")
|
nuclear@0
|
74
|
nuclear@0
|
75 // magic bytes used in GameStudio A5+ MDL meshes
|
nuclear@0
|
76 #define AI_MDL_MAGIC_NUMBER_BE_GS5a AI_MAKE_MAGIC("MDL4")
|
nuclear@0
|
77 #define AI_MDL_MAGIC_NUMBER_LE_GS5a AI_MAKE_MAGIC("4LDM")
|
nuclear@0
|
78 #define AI_MDL_MAGIC_NUMBER_BE_GS5b AI_MAKE_MAGIC("MDL5")
|
nuclear@0
|
79 #define AI_MDL_MAGIC_NUMBER_LE_GS5b AI_MAKE_MAGIC("5LDM")
|
nuclear@0
|
80
|
nuclear@0
|
81 // magic bytes used in GameStudio A7+ MDL meshes
|
nuclear@0
|
82 #define AI_MDL_MAGIC_NUMBER_BE_GS7 AI_MAKE_MAGIC("MDL7")
|
nuclear@0
|
83 #define AI_MDL_MAGIC_NUMBER_LE_GS7 AI_MAKE_MAGIC("7LDM")
|
nuclear@0
|
84
|
nuclear@0
|
85
|
nuclear@0
|
86 // common limitations for Quake1 meshes. The loader does not check them,
|
nuclear@0
|
87 // (however it warns) but models should not exceed these limits.
|
nuclear@0
|
88 #if (!defined AI_MDL_VERSION)
|
nuclear@0
|
89 # define AI_MDL_VERSION 6
|
nuclear@0
|
90 #endif
|
nuclear@0
|
91 #if (!defined AI_MDL_MAX_FRAMES)
|
nuclear@0
|
92 # define AI_MDL_MAX_FRAMES 256
|
nuclear@0
|
93 #endif
|
nuclear@0
|
94 #if (!defined AI_MDL_MAX_UVS)
|
nuclear@0
|
95 # define AI_MDL_MAX_UVS 1024
|
nuclear@0
|
96 #endif
|
nuclear@0
|
97 #if (!defined AI_MDL_MAX_VERTS)
|
nuclear@0
|
98 # define AI_MDL_MAX_VERTS 1024
|
nuclear@0
|
99 #endif
|
nuclear@0
|
100 #if (!defined AI_MDL_MAX_TRIANGLES)
|
nuclear@0
|
101 # define AI_MDL_MAX_TRIANGLES 2048
|
nuclear@0
|
102 #endif
|
nuclear@0
|
103
|
nuclear@0
|
104 // material key that is set for dummy materials that are
|
nuclear@0
|
105 // just referencing another material
|
nuclear@0
|
106 #if (!defined AI_MDL7_REFERRER_MATERIAL)
|
nuclear@0
|
107 # define AI_MDL7_REFERRER_MATERIAL "&&&referrer&&&",0,0
|
nuclear@0
|
108 #endif
|
nuclear@0
|
109
|
nuclear@0
|
110 // -------------------------------------------------------------------------------------
|
nuclear@0
|
111 /** \struct Header
|
nuclear@0
|
112 * \brief Data structure for the MDL main header
|
nuclear@0
|
113 */
|
nuclear@0
|
114 struct Header
|
nuclear@0
|
115 {
|
nuclear@0
|
116 //! magic number: "IDPO"
|
nuclear@0
|
117 uint32_t ident;
|
nuclear@0
|
118
|
nuclear@0
|
119 //! version number: 6
|
nuclear@0
|
120 int32_t version;
|
nuclear@0
|
121
|
nuclear@0
|
122 //! scale factors for each axis
|
nuclear@0
|
123 aiVector3D scale;
|
nuclear@0
|
124
|
nuclear@0
|
125 //! translation factors for each axis
|
nuclear@0
|
126 aiVector3D translate;
|
nuclear@0
|
127
|
nuclear@0
|
128 //! bounding radius of the mesh
|
nuclear@0
|
129 float boundingradius;
|
nuclear@0
|
130
|
nuclear@0
|
131 //! Position of the viewer's exe. Ignored
|
nuclear@0
|
132 aiVector3D vEyePos;
|
nuclear@0
|
133
|
nuclear@0
|
134 //! Number of textures
|
nuclear@0
|
135 int32_t num_skins;
|
nuclear@0
|
136
|
nuclear@0
|
137 //! Texture width in pixels
|
nuclear@0
|
138 int32_t skinwidth;
|
nuclear@0
|
139
|
nuclear@0
|
140 //! Texture height in pixels
|
nuclear@0
|
141 int32_t skinheight;
|
nuclear@0
|
142
|
nuclear@0
|
143 //! Number of vertices contained in the file
|
nuclear@0
|
144 int32_t num_verts;
|
nuclear@0
|
145
|
nuclear@0
|
146 //! Number of triangles contained in the file
|
nuclear@0
|
147 int32_t num_tris;
|
nuclear@0
|
148
|
nuclear@0
|
149 //! Number of frames contained in the file
|
nuclear@0
|
150 int32_t num_frames;
|
nuclear@0
|
151
|
nuclear@0
|
152 //! 0 = synchron, 1 = random . Ignored
|
nuclear@0
|
153 //! (MDLn formats: number of texture coordinates)
|
nuclear@0
|
154 int32_t synctype;
|
nuclear@0
|
155
|
nuclear@0
|
156 //! State flag
|
nuclear@0
|
157 int32_t flags;
|
nuclear@0
|
158
|
nuclear@0
|
159 //! Could be the total size of the file (and not a float)
|
nuclear@0
|
160 float size;
|
nuclear@0
|
161 } PACK_STRUCT;
|
nuclear@0
|
162
|
nuclear@0
|
163
|
nuclear@0
|
164 // -------------------------------------------------------------------------------------
|
nuclear@0
|
165 /** \struct Header_MDL7
|
nuclear@0
|
166 * \brief Data structure for the MDL 7 main header
|
nuclear@0
|
167 */
|
nuclear@0
|
168 struct Header_MDL7
|
nuclear@0
|
169 {
|
nuclear@0
|
170 //! magic number: "MDL7"
|
nuclear@0
|
171 char ident[4];
|
nuclear@0
|
172
|
nuclear@0
|
173 //! Version number. Ignored
|
nuclear@0
|
174 int32_t version;
|
nuclear@0
|
175
|
nuclear@0
|
176 //! Number of bones in file
|
nuclear@0
|
177 uint32_t bones_num;
|
nuclear@0
|
178
|
nuclear@0
|
179 //! Number of groups in file
|
nuclear@0
|
180 uint32_t groups_num;
|
nuclear@0
|
181
|
nuclear@0
|
182 //! Size of data in the file
|
nuclear@0
|
183 uint32_t data_size;
|
nuclear@0
|
184
|
nuclear@0
|
185 //! Ignored. Used to store entity specific information
|
nuclear@0
|
186 int32_t entlump_size;
|
nuclear@0
|
187
|
nuclear@0
|
188 //! Ignored. Used to store MED related data
|
nuclear@0
|
189 int32_t medlump_size;
|
nuclear@0
|
190
|
nuclear@0
|
191 //! Size of the Bone_MDL7 data structure used in the file
|
nuclear@0
|
192 uint16_t bone_stc_size;
|
nuclear@0
|
193
|
nuclear@0
|
194 //! Size of the Skin_MDL 7 data structure used in the file
|
nuclear@0
|
195 uint16_t skin_stc_size;
|
nuclear@0
|
196
|
nuclear@0
|
197 //! Size of a single color (e.g. in a material)
|
nuclear@0
|
198 uint16_t colorvalue_stc_size;
|
nuclear@0
|
199
|
nuclear@0
|
200 //! Size of the Material_MDL7 data structure used in the file
|
nuclear@0
|
201 uint16_t material_stc_size;
|
nuclear@0
|
202
|
nuclear@0
|
203 //! Size of a texture coordinate set in the file
|
nuclear@0
|
204 uint16_t skinpoint_stc_size;
|
nuclear@0
|
205
|
nuclear@0
|
206 //! Size of a triangle in the file
|
nuclear@0
|
207 uint16_t triangle_stc_size;
|
nuclear@0
|
208
|
nuclear@0
|
209 //! Size of a normal vertex in the file
|
nuclear@0
|
210 uint16_t mainvertex_stc_size;
|
nuclear@0
|
211
|
nuclear@0
|
212 //! Size of a per-frame animated vertex in the file
|
nuclear@0
|
213 //! (this is not supported)
|
nuclear@0
|
214 uint16_t framevertex_stc_size;
|
nuclear@0
|
215
|
nuclear@0
|
216 //! Size of a bone animation matrix
|
nuclear@0
|
217 uint16_t bonetrans_stc_size;
|
nuclear@0
|
218
|
nuclear@0
|
219 //! Size of the Frame_MDL7 data structure used in the file
|
nuclear@0
|
220 uint16_t frame_stc_size;
|
nuclear@0
|
221 } PACK_STRUCT;
|
nuclear@0
|
222
|
nuclear@0
|
223
|
nuclear@0
|
224 // -------------------------------------------------------------------------------------
|
nuclear@0
|
225 /** \struct Bone_MDL7
|
nuclear@0
|
226 * \brief Data structure for a bone in a MDL7 file
|
nuclear@0
|
227 */
|
nuclear@0
|
228 struct Bone_MDL7
|
nuclear@0
|
229 {
|
nuclear@0
|
230 //! Index of the parent bone of *this* bone. 0xffff means:
|
nuclear@0
|
231 //! "hey, I have no parent, I'm an orphan"
|
nuclear@0
|
232 uint16_t parent_index;
|
nuclear@0
|
233 uint8_t _unused_[2];
|
nuclear@0
|
234
|
nuclear@0
|
235 //! Relative position of the bone (relative to the
|
nuclear@0
|
236 //! parent bone)
|
nuclear@0
|
237 float x,y,z;
|
nuclear@0
|
238
|
nuclear@0
|
239 //! Optional name of the bone
|
nuclear@0
|
240 char name[1 /* DUMMY SIZE */];
|
nuclear@0
|
241 } PACK_STRUCT;
|
nuclear@0
|
242
|
nuclear@0
|
243 #if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS)
|
nuclear@0
|
244 # define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_20_CHARS (16 + 20)
|
nuclear@0
|
245 #endif
|
nuclear@0
|
246
|
nuclear@0
|
247 #if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_32_CHARS)
|
nuclear@0
|
248 # define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_32_CHARS (16 + 32)
|
nuclear@0
|
249 #endif
|
nuclear@0
|
250
|
nuclear@0
|
251 #if (!defined AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_NOT_THERE)
|
nuclear@0
|
252 # define AI_MDL7_BONE_STRUCT_SIZE__NAME_IS_NOT_THERE (16)
|
nuclear@0
|
253 #endif
|
nuclear@0
|
254
|
nuclear@0
|
255 #if (!defined AI_MDL7_MAX_GROUPNAMESIZE)
|
nuclear@0
|
256 # define AI_MDL7_MAX_GROUPNAMESIZE 16
|
nuclear@0
|
257 #endif // ! AI_MDL7_MAX_GROUPNAMESIZE
|
nuclear@0
|
258
|
nuclear@0
|
259 // -------------------------------------------------------------------------------------
|
nuclear@0
|
260 /** \struct Group_MDL7
|
nuclear@0
|
261 * \brief Group in a MDL7 file
|
nuclear@0
|
262 */
|
nuclear@0
|
263 struct Group_MDL7
|
nuclear@0
|
264 {
|
nuclear@0
|
265 //! = '1' -> triangle based Mesh
|
nuclear@0
|
266 unsigned char typ;
|
nuclear@0
|
267
|
nuclear@0
|
268 int8_t deformers;
|
nuclear@0
|
269 int8_t max_weights;
|
nuclear@0
|
270 int8_t _unused_;
|
nuclear@0
|
271
|
nuclear@0
|
272 //! size of data for this group in bytes ( MD7_GROUP stc. included).
|
nuclear@0
|
273 int32_t groupdata_size;
|
nuclear@0
|
274 char name[AI_MDL7_MAX_GROUPNAMESIZE];
|
nuclear@0
|
275
|
nuclear@0
|
276 //! Number of skins
|
nuclear@0
|
277 int32_t numskins;
|
nuclear@0
|
278
|
nuclear@0
|
279 //! Number of texture coordinates
|
nuclear@0
|
280 int32_t num_stpts;
|
nuclear@0
|
281
|
nuclear@0
|
282 //! Number of triangles
|
nuclear@0
|
283 int32_t numtris;
|
nuclear@0
|
284
|
nuclear@0
|
285 //! Number of vertices
|
nuclear@0
|
286 int32_t numverts;
|
nuclear@0
|
287
|
nuclear@0
|
288 //! Number of frames
|
nuclear@0
|
289 int32_t numframes;
|
nuclear@0
|
290 } PACK_STRUCT;
|
nuclear@0
|
291
|
nuclear@0
|
292 #define AI_MDL7_SKINTYPE_MIPFLAG 0x08
|
nuclear@0
|
293 #define AI_MDL7_SKINTYPE_MATERIAL 0x10
|
nuclear@0
|
294 #define AI_MDL7_SKINTYPE_MATERIAL_ASCDEF 0x20
|
nuclear@0
|
295 #define AI_MDL7_SKINTYPE_RGBFLAG 0x80
|
nuclear@0
|
296
|
nuclear@0
|
297 #if (!defined AI_MDL7_MAX_BONENAMESIZE)
|
nuclear@0
|
298 # define AI_MDL7_MAX_BONENAMESIZE 20
|
nuclear@0
|
299 #endif // !! AI_MDL7_MAX_BONENAMESIZE
|
nuclear@0
|
300
|
nuclear@0
|
301 // -------------------------------------------------------------------------------------
|
nuclear@0
|
302 /** \struct Deformer_MDL7
|
nuclear@0
|
303 * \brief Deformer in a MDL7 file
|
nuclear@0
|
304 */
|
nuclear@0
|
305 struct Deformer_MDL7
|
nuclear@0
|
306 {
|
nuclear@0
|
307 int8_t deformer_version; // 0
|
nuclear@0
|
308 int8_t deformer_typ; // 0 - bones
|
nuclear@0
|
309 int8_t _unused_[2];
|
nuclear@0
|
310 int32_t group_index;
|
nuclear@0
|
311 int32_t elements;
|
nuclear@0
|
312 int32_t deformerdata_size;
|
nuclear@0
|
313 } PACK_STRUCT;
|
nuclear@0
|
314
|
nuclear@0
|
315
|
nuclear@0
|
316 // -------------------------------------------------------------------------------------
|
nuclear@0
|
317 /** \struct DeformerElement_MDL7
|
nuclear@0
|
318 * \brief Deformer element in a MDL7 file
|
nuclear@0
|
319 */
|
nuclear@0
|
320 struct DeformerElement_MDL7
|
nuclear@0
|
321 {
|
nuclear@0
|
322 //! bei deformer_typ==0 (==bones) element_index == bone index
|
nuclear@0
|
323 int32_t element_index;
|
nuclear@0
|
324 char element_name[AI_MDL7_MAX_BONENAMESIZE];
|
nuclear@0
|
325 int32_t weights;
|
nuclear@0
|
326 } PACK_STRUCT;
|
nuclear@0
|
327
|
nuclear@0
|
328
|
nuclear@0
|
329 // -------------------------------------------------------------------------------------
|
nuclear@0
|
330 /** \struct DeformerWeight_MDL7
|
nuclear@0
|
331 * \brief Deformer weight in a MDL7 file
|
nuclear@0
|
332 */
|
nuclear@0
|
333 struct DeformerWeight_MDL7
|
nuclear@0
|
334 {
|
nuclear@0
|
335 //! for deformer_typ==0 (==bones) index == vertex index
|
nuclear@0
|
336 int32_t index;
|
nuclear@0
|
337 float weight;
|
nuclear@0
|
338 } PACK_STRUCT;
|
nuclear@0
|
339
|
nuclear@0
|
340
|
nuclear@0
|
341 // don't know why this was in the original headers ...
|
nuclear@0
|
342 typedef int32_t MD7_MATERIAL_ASCDEFSIZE;
|
nuclear@0
|
343
|
nuclear@0
|
344 // -------------------------------------------------------------------------------------
|
nuclear@0
|
345 /** \struct ColorValue_MDL7
|
nuclear@0
|
346 * \brief Data structure for a color value in a MDL7 file
|
nuclear@0
|
347 */
|
nuclear@0
|
348 struct ColorValue_MDL7
|
nuclear@0
|
349 {
|
nuclear@0
|
350 float r,g,b,a;
|
nuclear@0
|
351 } PACK_STRUCT;
|
nuclear@0
|
352
|
nuclear@0
|
353 // -------------------------------------------------------------------------------------
|
nuclear@0
|
354 /** \struct Material_MDL7
|
nuclear@0
|
355 * \brief Data structure for a Material in a MDL7 file
|
nuclear@0
|
356 */
|
nuclear@0
|
357 struct Material_MDL7
|
nuclear@0
|
358 {
|
nuclear@0
|
359 //! Diffuse base color of the material
|
nuclear@0
|
360 ColorValue_MDL7 Diffuse;
|
nuclear@0
|
361
|
nuclear@0
|
362 //! Ambient base color of the material
|
nuclear@0
|
363 ColorValue_MDL7 Ambient;
|
nuclear@0
|
364
|
nuclear@0
|
365 //! Specular base color of the material
|
nuclear@0
|
366 ColorValue_MDL7 Specular;
|
nuclear@0
|
367
|
nuclear@0
|
368 //! Emissive base color of the material
|
nuclear@0
|
369 ColorValue_MDL7 Emissive;
|
nuclear@0
|
370
|
nuclear@0
|
371 //! Phong power
|
nuclear@0
|
372 float Power;
|
nuclear@0
|
373 } PACK_STRUCT;
|
nuclear@0
|
374
|
nuclear@0
|
375
|
nuclear@0
|
376 // -------------------------------------------------------------------------------------
|
nuclear@0
|
377 /** \struct Skin
|
nuclear@0
|
378 * \brief Skin data structure #1 - used by Quake1, MDL2, MDL3 and MDL4
|
nuclear@0
|
379 */
|
nuclear@0
|
380 struct Skin
|
nuclear@0
|
381 {
|
nuclear@0
|
382 //! 0 = single (Skin), 1 = group (GroupSkin)
|
nuclear@0
|
383 //! For MDL3-5: Defines the type of the skin and there
|
nuclear@0
|
384 //! fore the size of the data to skip:
|
nuclear@0
|
385 //-------------------------------------------------------
|
nuclear@0
|
386 //! 2 for 565 RGB,
|
nuclear@0
|
387 //! 3 for 4444 ARGB,
|
nuclear@0
|
388 //! 10 for 565 mipmapped,
|
nuclear@0
|
389 //! 11 for 4444 mipmapped (bpp = 2),
|
nuclear@0
|
390 //! 12 for 888 RGB mipmapped (bpp = 3),
|
nuclear@0
|
391 //! 13 for 8888 ARGB mipmapped (bpp = 4)
|
nuclear@0
|
392 //-------------------------------------------------------
|
nuclear@0
|
393 int32_t group;
|
nuclear@0
|
394
|
nuclear@0
|
395 //! Texture data
|
nuclear@0
|
396 uint8_t *data;
|
nuclear@0
|
397 } PACK_STRUCT;
|
nuclear@0
|
398
|
nuclear@0
|
399
|
nuclear@0
|
400 // -------------------------------------------------------------------------------------
|
nuclear@0
|
401 /** \struct Skin
|
nuclear@0
|
402 * \brief Skin data structure #2 - used by MDL5, MDL6 and MDL7
|
nuclear@0
|
403 * \see Skin
|
nuclear@0
|
404 */
|
nuclear@0
|
405 struct Skin_MDL5
|
nuclear@0
|
406 {
|
nuclear@0
|
407 int32_t size, width, height;
|
nuclear@0
|
408 uint8_t *data;
|
nuclear@0
|
409 } PACK_STRUCT;
|
nuclear@0
|
410
|
nuclear@0
|
411 // maximum length of texture file name
|
nuclear@0
|
412 #if (!defined AI_MDL7_MAX_TEXNAMESIZE)
|
nuclear@0
|
413 # define AI_MDL7_MAX_TEXNAMESIZE 0x10
|
nuclear@0
|
414 #endif
|
nuclear@0
|
415
|
nuclear@0
|
416 // ---------------------------------------------------------------------------
|
nuclear@0
|
417 /** \struct Skin_MDL7
|
nuclear@0
|
418 * \brief Skin data structure #3 - used by MDL7 and HMP7
|
nuclear@0
|
419 */
|
nuclear@0
|
420 struct Skin_MDL7
|
nuclear@0
|
421 {
|
nuclear@0
|
422 uint8_t typ;
|
nuclear@0
|
423 int8_t _unused_[3];
|
nuclear@0
|
424 int32_t width;
|
nuclear@0
|
425 int32_t height;
|
nuclear@0
|
426 char texture_name[AI_MDL7_MAX_TEXNAMESIZE];
|
nuclear@0
|
427 } PACK_STRUCT;
|
nuclear@0
|
428
|
nuclear@0
|
429 // -------------------------------------------------------------------------------------
|
nuclear@0
|
430 /** \struct RGB565
|
nuclear@0
|
431 * \brief Data structure for a RGB565 pixel in a texture
|
nuclear@0
|
432 */
|
nuclear@0
|
433 struct RGB565
|
nuclear@0
|
434 {
|
nuclear@0
|
435 uint16_t r : 5;
|
nuclear@0
|
436 uint16_t g : 6;
|
nuclear@0
|
437 uint16_t b : 5;
|
nuclear@0
|
438 } PACK_STRUCT;
|
nuclear@0
|
439
|
nuclear@0
|
440 // -------------------------------------------------------------------------------------
|
nuclear@0
|
441 /** \struct ARGB4
|
nuclear@0
|
442 * \brief Data structure for a ARGB4444 pixel in a texture
|
nuclear@0
|
443 */
|
nuclear@0
|
444 struct ARGB4
|
nuclear@0
|
445 {
|
nuclear@0
|
446 uint16_t a : 4;
|
nuclear@0
|
447 uint16_t r : 4;
|
nuclear@0
|
448 uint16_t g : 4;
|
nuclear@0
|
449 uint16_t b : 4;
|
nuclear@0
|
450 } PACK_STRUCT;
|
nuclear@0
|
451
|
nuclear@0
|
452 // -------------------------------------------------------------------------------------
|
nuclear@0
|
453 /** \struct GroupSkin
|
nuclear@0
|
454 * \brief Skin data structure #2 (group of pictures)
|
nuclear@0
|
455 */
|
nuclear@0
|
456 struct GroupSkin
|
nuclear@0
|
457 {
|
nuclear@0
|
458 //! 0 = single (Skin), 1 = group (GroupSkin)
|
nuclear@0
|
459 int32_t group;
|
nuclear@0
|
460
|
nuclear@0
|
461 //! Number of images
|
nuclear@0
|
462 int32_t nb;
|
nuclear@0
|
463
|
nuclear@0
|
464 //! Time for each image
|
nuclear@0
|
465 float *time;
|
nuclear@0
|
466
|
nuclear@0
|
467 //! Data of each image
|
nuclear@0
|
468 uint8_t **data;
|
nuclear@0
|
469 } PACK_STRUCT;
|
nuclear@0
|
470
|
nuclear@0
|
471 // -------------------------------------------------------------------------------------
|
nuclear@0
|
472 /** \struct TexCoord
|
nuclear@0
|
473 * \brief Texture coordinate data structure used by the Quake1 MDL format
|
nuclear@0
|
474 */
|
nuclear@0
|
475 struct TexCoord
|
nuclear@0
|
476 {
|
nuclear@0
|
477 //! Is the vertex on the noundary between front and back piece?
|
nuclear@0
|
478 int32_t onseam;
|
nuclear@0
|
479
|
nuclear@0
|
480 //! Texture coordinate in the tx direction
|
nuclear@0
|
481 int32_t s;
|
nuclear@0
|
482
|
nuclear@0
|
483 //! Texture coordinate in the ty direction
|
nuclear@0
|
484 int32_t t;
|
nuclear@0
|
485 } PACK_STRUCT;
|
nuclear@0
|
486
|
nuclear@0
|
487 // -------------------------------------------------------------------------------------
|
nuclear@0
|
488 /** \struct TexCoord_MDL3
|
nuclear@0
|
489 * \brief Data structure for an UV coordinate in the 3DGS MDL3 format
|
nuclear@0
|
490 */
|
nuclear@0
|
491 struct TexCoord_MDL3
|
nuclear@0
|
492 {
|
nuclear@0
|
493 //! position, horizontally in range 0..skinwidth-1
|
nuclear@0
|
494 int16_t u;
|
nuclear@0
|
495
|
nuclear@0
|
496 //! position, vertically in range 0..skinheight-1
|
nuclear@0
|
497 int16_t v;
|
nuclear@0
|
498 } PACK_STRUCT;
|
nuclear@0
|
499
|
nuclear@0
|
500 // -------------------------------------------------------------------------------------
|
nuclear@0
|
501 /** \struct TexCoord_MDL7
|
nuclear@0
|
502 * \brief Data structure for an UV coordinate in the 3DGS MDL7 format
|
nuclear@0
|
503 */
|
nuclear@0
|
504 struct TexCoord_MDL7
|
nuclear@0
|
505 {
|
nuclear@0
|
506 //! position, horizontally in range 0..1
|
nuclear@0
|
507 float u;
|
nuclear@0
|
508
|
nuclear@0
|
509 //! position, vertically in range 0..1
|
nuclear@0
|
510 float v;
|
nuclear@0
|
511 } PACK_STRUCT;
|
nuclear@0
|
512
|
nuclear@0
|
513 // -------------------------------------------------------------------------------------
|
nuclear@0
|
514 /** \struct SkinSet_MDL7
|
nuclear@0
|
515 * \brief Skin set data structure for the 3DGS MDL7 format
|
nuclear@0
|
516 * MDL7 references UV coordinates per face via an index list.
|
nuclear@0
|
517 * This allows the use of multiple skins per face with just one
|
nuclear@0
|
518 * UV coordinate set.
|
nuclear@0
|
519 */
|
nuclear@0
|
520 struct SkinSet_MDL7
|
nuclear@0
|
521 {
|
nuclear@0
|
522 //! Index into the UV coordinate list
|
nuclear@0
|
523 uint16_t st_index[3]; // size 6
|
nuclear@0
|
524
|
nuclear@0
|
525 //! Material index
|
nuclear@0
|
526 int32_t material; // size 4
|
nuclear@0
|
527 } PACK_STRUCT;
|
nuclear@0
|
528
|
nuclear@0
|
529 // -------------------------------------------------------------------------------------
|
nuclear@0
|
530 /** \struct Triangle
|
nuclear@0
|
531 * \brief Triangle data structure for the Quake1 MDL format
|
nuclear@0
|
532 */
|
nuclear@0
|
533 struct Triangle
|
nuclear@0
|
534 {
|
nuclear@0
|
535 //! 0 = backface, 1 = frontface
|
nuclear@0
|
536 int32_t facesfront;
|
nuclear@0
|
537
|
nuclear@0
|
538 //! Vertex indices
|
nuclear@0
|
539 int32_t vertex[3];
|
nuclear@0
|
540 } PACK_STRUCT;
|
nuclear@0
|
541
|
nuclear@0
|
542 // -------------------------------------------------------------------------------------
|
nuclear@0
|
543 /** \struct Triangle_MDL3
|
nuclear@0
|
544 * \brief Triangle data structure for the 3DGS MDL3 format
|
nuclear@0
|
545 */
|
nuclear@0
|
546 struct Triangle_MDL3
|
nuclear@0
|
547 {
|
nuclear@0
|
548 //! Index of 3 3D vertices in range 0..numverts
|
nuclear@0
|
549 uint16_t index_xyz[3];
|
nuclear@0
|
550
|
nuclear@0
|
551 //! Index of 3 skin vertices in range 0..numskinverts
|
nuclear@0
|
552 uint16_t index_uv[3];
|
nuclear@0
|
553 } PACK_STRUCT;
|
nuclear@0
|
554
|
nuclear@0
|
555 // -------------------------------------------------------------------------------------
|
nuclear@0
|
556 /** \struct Triangle_MDL7
|
nuclear@0
|
557 * \brief Triangle data structure for the 3DGS MDL7 format
|
nuclear@0
|
558 */
|
nuclear@0
|
559 struct Triangle_MDL7
|
nuclear@0
|
560 {
|
nuclear@0
|
561 //! Vertex indices
|
nuclear@0
|
562 uint16_t v_index[3]; // size 6
|
nuclear@0
|
563
|
nuclear@0
|
564 //! Two skinsets. The second will be used for multi-texturing
|
nuclear@0
|
565 SkinSet_MDL7 skinsets[2];
|
nuclear@0
|
566 } PACK_STRUCT;
|
nuclear@0
|
567
|
nuclear@0
|
568 #if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV)
|
nuclear@0
|
569 # define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV (6+sizeof(SkinSet_MDL7)-sizeof(uint32_t))
|
nuclear@0
|
570 #endif
|
nuclear@0
|
571 #if (!defined AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV_WITH_MATINDEX)
|
nuclear@0
|
572 # define AI_MDL7_TRIANGLE_STD_SIZE_ONE_UV_WITH_MATINDEX (6+sizeof(SkinSet_MDL7))
|
nuclear@0
|
573 #endif
|
nuclear@0
|
574 #if (!defined AI_MDL7_TRIANGLE_STD_SIZE_TWO_UV)
|
nuclear@0
|
575 # define AI_MDL7_TRIANGLE_STD_SIZE_TWO_UV (6+2*sizeof(SkinSet_MDL7))
|
nuclear@0
|
576 #endif
|
nuclear@0
|
577
|
nuclear@0
|
578 // Helper constants for Triangle::facesfront
|
nuclear@0
|
579 #if (!defined AI_MDL_BACKFACE)
|
nuclear@0
|
580 # define AI_MDL_BACKFACE 0x0
|
nuclear@0
|
581 #endif
|
nuclear@0
|
582 #if (!defined AI_MDL_FRONTFACE)
|
nuclear@0
|
583 # define AI_MDL_FRONTFACE 0x1
|
nuclear@0
|
584 #endif
|
nuclear@0
|
585
|
nuclear@0
|
586 // -------------------------------------------------------------------------------------
|
nuclear@0
|
587 /** \struct Vertex
|
nuclear@0
|
588 * \brief Vertex data structure
|
nuclear@0
|
589 */
|
nuclear@0
|
590 struct Vertex
|
nuclear@0
|
591 {
|
nuclear@0
|
592 uint8_t v[3];
|
nuclear@0
|
593 uint8_t normalIndex;
|
nuclear@0
|
594 } PACK_STRUCT;
|
nuclear@0
|
595
|
nuclear@0
|
596
|
nuclear@0
|
597 // -------------------------------------------------------------------------------------
|
nuclear@0
|
598 struct Vertex_MDL4
|
nuclear@0
|
599 {
|
nuclear@0
|
600 uint16_t v[3];
|
nuclear@0
|
601 uint8_t normalIndex;
|
nuclear@0
|
602 uint8_t unused;
|
nuclear@0
|
603 } PACK_STRUCT;
|
nuclear@0
|
604
|
nuclear@0
|
605 #define AI_MDL7_FRAMEVERTEX120503_STCSIZE 16
|
nuclear@0
|
606 #define AI_MDL7_FRAMEVERTEX030305_STCSIZE 26
|
nuclear@0
|
607
|
nuclear@0
|
608 // -------------------------------------------------------------------------------------
|
nuclear@0
|
609 /** \struct Vertex_MDL7
|
nuclear@0
|
610 * \brief Vertex data structure used in MDL7 files
|
nuclear@0
|
611 */
|
nuclear@0
|
612 struct Vertex_MDL7
|
nuclear@0
|
613 {
|
nuclear@0
|
614 float x,y,z;
|
nuclear@0
|
615 uint16_t vertindex; // = bone index
|
nuclear@0
|
616 union {
|
nuclear@0
|
617 uint8_t norm162index;
|
nuclear@0
|
618 float norm[3];
|
nuclear@0
|
619 };
|
nuclear@0
|
620 } PACK_STRUCT;
|
nuclear@0
|
621
|
nuclear@0
|
622
|
nuclear@0
|
623 // -------------------------------------------------------------------------------------
|
nuclear@0
|
624 /** \struct BoneTransform_MDL7
|
nuclear@0
|
625 * \brief bone transformation matrix structure used in MDL7 files
|
nuclear@0
|
626 */
|
nuclear@0
|
627 struct BoneTransform_MDL7
|
nuclear@0
|
628 {
|
nuclear@0
|
629 //! 4*3
|
nuclear@0
|
630 float m [4*4];
|
nuclear@0
|
631
|
nuclear@0
|
632 //! the index of this vertex, 0.. header::bones_num - 1
|
nuclear@0
|
633 uint16_t bone_index;
|
nuclear@0
|
634
|
nuclear@0
|
635 //! I HATE 3DGS AND THE SILLY DEVELOPER WHO DESIGNED
|
nuclear@0
|
636 //! THIS STUPID FILE FORMAT!
|
nuclear@0
|
637 int8_t _unused_[2];
|
nuclear@0
|
638 } PACK_STRUCT;
|
nuclear@0
|
639
|
nuclear@0
|
640
|
nuclear@0
|
641 #define AI_MDL7_MAX_FRAMENAMESIZE 16
|
nuclear@0
|
642
|
nuclear@0
|
643
|
nuclear@0
|
644 // -------------------------------------------------------------------------------------
|
nuclear@0
|
645 /** \struct Frame_MDL7
|
nuclear@0
|
646 * \brief Frame data structure used by MDL7 files
|
nuclear@0
|
647 */
|
nuclear@0
|
648 struct Frame_MDL7
|
nuclear@0
|
649 {
|
nuclear@0
|
650 char frame_name[AI_MDL7_MAX_FRAMENAMESIZE];
|
nuclear@0
|
651 uint32_t vertices_count;
|
nuclear@0
|
652 uint32_t transmatrix_count;
|
nuclear@0
|
653 };
|
nuclear@0
|
654
|
nuclear@0
|
655
|
nuclear@0
|
656 // -------------------------------------------------------------------------------------
|
nuclear@0
|
657 /** \struct SimpleFrame
|
nuclear@0
|
658 * \brief Data structure for a simple frame
|
nuclear@0
|
659 */
|
nuclear@0
|
660 struct SimpleFrame
|
nuclear@0
|
661 {
|
nuclear@0
|
662 //! Minimum vertex of the bounding box
|
nuclear@0
|
663 Vertex bboxmin;
|
nuclear@0
|
664
|
nuclear@0
|
665 //! Maximum vertex of the bounding box
|
nuclear@0
|
666 Vertex bboxmax;
|
nuclear@0
|
667
|
nuclear@0
|
668 //! Name of the frame
|
nuclear@0
|
669 char name[16];
|
nuclear@0
|
670
|
nuclear@0
|
671 //! Vertex list of the frame
|
nuclear@0
|
672 Vertex *verts;
|
nuclear@0
|
673 } PACK_STRUCT;
|
nuclear@0
|
674
|
nuclear@0
|
675 // -------------------------------------------------------------------------------------
|
nuclear@0
|
676 /** \struct Frame
|
nuclear@0
|
677 * \brief Model frame data structure
|
nuclear@0
|
678 */
|
nuclear@0
|
679 struct Frame
|
nuclear@0
|
680 {
|
nuclear@0
|
681 //! 0 = simple frame, !0 = group frame
|
nuclear@0
|
682 int32_t type;
|
nuclear@0
|
683
|
nuclear@0
|
684 //! Frame data
|
nuclear@0
|
685 SimpleFrame frame;
|
nuclear@0
|
686 } PACK_STRUCT;
|
nuclear@0
|
687
|
nuclear@0
|
688
|
nuclear@0
|
689 // -------------------------------------------------------------------------------------
|
nuclear@0
|
690 struct SimpleFrame_MDLn_SP
|
nuclear@0
|
691 {
|
nuclear@0
|
692 //! Minimum vertex of the bounding box
|
nuclear@0
|
693 Vertex_MDL4 bboxmin;
|
nuclear@0
|
694
|
nuclear@0
|
695 //! Maximum vertex of the bounding box
|
nuclear@0
|
696 Vertex_MDL4 bboxmax;
|
nuclear@0
|
697
|
nuclear@0
|
698 //! Name of the frame
|
nuclear@0
|
699 char name[16];
|
nuclear@0
|
700
|
nuclear@0
|
701 //! Vertex list of the frame
|
nuclear@0
|
702 Vertex_MDL4 *verts;
|
nuclear@0
|
703 } PACK_STRUCT;
|
nuclear@0
|
704
|
nuclear@0
|
705 // -------------------------------------------------------------------------------------
|
nuclear@0
|
706 /** \struct GroupFrame
|
nuclear@0
|
707 * \brief Data structure for a group of frames
|
nuclear@0
|
708 */
|
nuclear@0
|
709 struct GroupFrame
|
nuclear@0
|
710 {
|
nuclear@0
|
711 //! 0 = simple frame, !0 = group frame
|
nuclear@0
|
712 int32_t type;
|
nuclear@0
|
713
|
nuclear@0
|
714 //! Minimum vertex for all single frames
|
nuclear@0
|
715 Vertex min;
|
nuclear@0
|
716
|
nuclear@0
|
717 //! Maximum vertex for all single frames
|
nuclear@0
|
718 Vertex max;
|
nuclear@0
|
719
|
nuclear@0
|
720 //! Time for all single frames
|
nuclear@0
|
721 float *time;
|
nuclear@0
|
722
|
nuclear@0
|
723 //! List of single frames
|
nuclear@0
|
724 SimpleFrame *frames;
|
nuclear@0
|
725 } PACK_STRUCT;
|
nuclear@0
|
726
|
nuclear@0
|
727 #include "assimp/Compiler/poppack1.h"
|
nuclear@0
|
728
|
nuclear@0
|
729 // -------------------------------------------------------------------------------------
|
nuclear@0
|
730 /** \struct IntFace_MDL7
|
nuclear@0
|
731 * \brief Internal data structure to temporarily represent a face
|
nuclear@0
|
732 */
|
nuclear@0
|
733 struct IntFace_MDL7
|
nuclear@0
|
734 {
|
nuclear@0
|
735 // provide a constructor for our own convenience
|
nuclear@0
|
736 IntFace_MDL7()
|
nuclear@0
|
737 {
|
nuclear@0
|
738 // set everything to zero
|
nuclear@0
|
739 mIndices[0] = mIndices[1] = mIndices[2] = 0;
|
nuclear@0
|
740 iMatIndex[0] = iMatIndex[1] = 0;
|
nuclear@0
|
741 }
|
nuclear@0
|
742
|
nuclear@0
|
743 //! Vertex indices
|
nuclear@0
|
744 uint32_t mIndices[3];
|
nuclear@0
|
745
|
nuclear@0
|
746 //! Material index (maximally two channels, which are joined later)
|
nuclear@0
|
747 unsigned int iMatIndex[2];
|
nuclear@0
|
748 };
|
nuclear@0
|
749
|
nuclear@0
|
750 // -------------------------------------------------------------------------------------
|
nuclear@0
|
751 /** \struct IntMaterial_MDL7
|
nuclear@0
|
752 * \brief Internal data structure to temporarily represent a material
|
nuclear@0
|
753 * which has been created from two single materials along with the
|
nuclear@0
|
754 * original material indices.
|
nuclear@0
|
755 */
|
nuclear@0
|
756 struct IntMaterial_MDL7
|
nuclear@0
|
757 {
|
nuclear@0
|
758 // provide a constructor for our own convenience
|
nuclear@0
|
759 IntMaterial_MDL7()
|
nuclear@0
|
760 {
|
nuclear@0
|
761 pcMat = NULL;
|
nuclear@0
|
762 iOldMatIndices[0] = iOldMatIndices[1] = 0;
|
nuclear@0
|
763 }
|
nuclear@0
|
764
|
nuclear@0
|
765 //! Material instance
|
nuclear@0
|
766 aiMaterial* pcMat;
|
nuclear@0
|
767
|
nuclear@0
|
768 //! Old material indices
|
nuclear@0
|
769 unsigned int iOldMatIndices[2];
|
nuclear@0
|
770 };
|
nuclear@0
|
771
|
nuclear@0
|
772 // -------------------------------------------------------------------------------------
|
nuclear@0
|
773 /** \struct IntBone_MDL7
|
nuclear@0
|
774 * \brief Internal data structure to represent a bone in a MDL7 file with
|
nuclear@0
|
775 * all of its animation channels assigned to it.
|
nuclear@0
|
776 */
|
nuclear@0
|
777 struct IntBone_MDL7 : aiBone
|
nuclear@0
|
778 {
|
nuclear@0
|
779 //! Default constructor
|
nuclear@0
|
780 IntBone_MDL7() : iParent (0xffff)
|
nuclear@0
|
781 {
|
nuclear@0
|
782 pkeyPositions.reserve(30);
|
nuclear@0
|
783 pkeyScalings.reserve(30);
|
nuclear@0
|
784 pkeyRotations.reserve(30);
|
nuclear@0
|
785 }
|
nuclear@0
|
786
|
nuclear@0
|
787 //! Parent bone of the bone
|
nuclear@0
|
788 uint64_t iParent;
|
nuclear@0
|
789
|
nuclear@0
|
790 //! Relative position of the bone
|
nuclear@0
|
791 aiVector3D vPosition;
|
nuclear@0
|
792
|
nuclear@0
|
793 //! Array of position keys
|
nuclear@0
|
794 std::vector<aiVectorKey> pkeyPositions;
|
nuclear@0
|
795
|
nuclear@0
|
796 //! Array of scaling keys
|
nuclear@0
|
797 std::vector<aiVectorKey> pkeyScalings;
|
nuclear@0
|
798
|
nuclear@0
|
799 //! Array of rotation keys
|
nuclear@0
|
800 std::vector<aiQuatKey> pkeyRotations;
|
nuclear@0
|
801 };
|
nuclear@0
|
802
|
nuclear@0
|
803 // -------------------------------------------------------------------------------------
|
nuclear@0
|
804 //! Describes a MDL7 frame
|
nuclear@0
|
805 struct IntFrameInfo_MDL7
|
nuclear@0
|
806 {
|
nuclear@0
|
807 //! Construction from an existing frame header
|
nuclear@0
|
808 IntFrameInfo_MDL7(BE_NCONST MDL::Frame_MDL7* _pcFrame,unsigned int _iIndex)
|
nuclear@0
|
809 : iIndex(_iIndex)
|
nuclear@0
|
810 , pcFrame(_pcFrame)
|
nuclear@0
|
811 {}
|
nuclear@0
|
812
|
nuclear@0
|
813 //! Index of the frame
|
nuclear@0
|
814 unsigned int iIndex;
|
nuclear@0
|
815
|
nuclear@0
|
816 //! Points to the header of the frame
|
nuclear@0
|
817 BE_NCONST MDL::Frame_MDL7* pcFrame;
|
nuclear@0
|
818 };
|
nuclear@0
|
819
|
nuclear@0
|
820 // -------------------------------------------------------------------------------------
|
nuclear@0
|
821 //! Describes a MDL7 mesh group
|
nuclear@0
|
822 struct IntGroupInfo_MDL7
|
nuclear@0
|
823 {
|
nuclear@0
|
824 //! Default constructor
|
nuclear@0
|
825 IntGroupInfo_MDL7()
|
nuclear@0
|
826 : iIndex(0)
|
nuclear@0
|
827 , pcGroup(NULL)
|
nuclear@0
|
828 , pcGroupUVs(NULL)
|
nuclear@0
|
829 , pcGroupTris(NULL)
|
nuclear@0
|
830 , pcGroupVerts(NULL)
|
nuclear@0
|
831 {}
|
nuclear@0
|
832
|
nuclear@0
|
833 //! Construction from an existing group header
|
nuclear@0
|
834 IntGroupInfo_MDL7(BE_NCONST MDL::Group_MDL7* _pcGroup, unsigned int _iIndex)
|
nuclear@0
|
835 : iIndex(_iIndex)
|
nuclear@0
|
836 , pcGroup(_pcGroup)
|
nuclear@0
|
837 {}
|
nuclear@0
|
838
|
nuclear@0
|
839 //! Index of the group
|
nuclear@0
|
840 unsigned int iIndex;
|
nuclear@0
|
841
|
nuclear@0
|
842 //! Points to the header of the group
|
nuclear@0
|
843 BE_NCONST MDL::Group_MDL7* pcGroup;
|
nuclear@0
|
844
|
nuclear@0
|
845 //! Points to the beginning of the uv coordinate section
|
nuclear@0
|
846 BE_NCONST MDL::TexCoord_MDL7* pcGroupUVs;
|
nuclear@0
|
847
|
nuclear@0
|
848 //! Points to the beginning of the triangle section
|
nuclear@0
|
849 MDL::Triangle_MDL7* pcGroupTris;
|
nuclear@0
|
850
|
nuclear@0
|
851 //! Points to the beginning of the vertex section
|
nuclear@0
|
852 BE_NCONST MDL::Vertex_MDL7* pcGroupVerts;
|
nuclear@0
|
853 };
|
nuclear@0
|
854
|
nuclear@0
|
855 // -------------------------------------------------------------------------------------
|
nuclear@0
|
856 //! Holds the data that belongs to a MDL7 mesh group
|
nuclear@0
|
857 struct IntGroupData_MDL7
|
nuclear@0
|
858 {
|
nuclear@0
|
859 IntGroupData_MDL7()
|
nuclear@0
|
860 : pcFaces(NULL), bNeed2UV(false)
|
nuclear@0
|
861 {}
|
nuclear@0
|
862
|
nuclear@0
|
863 //! Array of faces that belong to the group
|
nuclear@0
|
864 MDL::IntFace_MDL7* pcFaces;
|
nuclear@0
|
865
|
nuclear@0
|
866 //! Array of vertex positions
|
nuclear@0
|
867 std::vector<aiVector3D> vPositions;
|
nuclear@0
|
868
|
nuclear@0
|
869 //! Array of vertex normals
|
nuclear@0
|
870 std::vector<aiVector3D> vNormals;
|
nuclear@0
|
871
|
nuclear@0
|
872 //! Array of bones indices
|
nuclear@0
|
873 std::vector<unsigned int> aiBones;
|
nuclear@0
|
874
|
nuclear@0
|
875 //! First UV coordinate set
|
nuclear@0
|
876 std::vector<aiVector3D> vTextureCoords1;
|
nuclear@0
|
877
|
nuclear@0
|
878 //! Optional second UV coordinate set
|
nuclear@0
|
879 std::vector<aiVector3D> vTextureCoords2;
|
nuclear@0
|
880
|
nuclear@0
|
881 //! Specifies whether there are two texture
|
nuclear@0
|
882 //! coordinate sets required
|
nuclear@0
|
883 bool bNeed2UV;
|
nuclear@0
|
884 };
|
nuclear@0
|
885
|
nuclear@0
|
886 // -------------------------------------------------------------------------------------
|
nuclear@0
|
887 //! Holds data from an MDL7 file that is shared by all mesh groups
|
nuclear@0
|
888 struct IntSharedData_MDL7
|
nuclear@0
|
889 {
|
nuclear@0
|
890 //! Default constructor
|
nuclear@0
|
891 IntSharedData_MDL7()
|
nuclear@0
|
892 {
|
nuclear@0
|
893 abNeedMaterials.reserve(10);
|
nuclear@0
|
894 }
|
nuclear@0
|
895
|
nuclear@0
|
896 //! Destruction: properly delete all allocated resources
|
nuclear@0
|
897 ~IntSharedData_MDL7()
|
nuclear@0
|
898 {
|
nuclear@0
|
899 // kill all bones
|
nuclear@0
|
900 if (this->apcOutBones)
|
nuclear@0
|
901 {
|
nuclear@0
|
902 for (unsigned int m = 0; m < iNum;++m)
|
nuclear@0
|
903 delete this->apcOutBones[m];
|
nuclear@0
|
904 delete[] this->apcOutBones;
|
nuclear@0
|
905 }
|
nuclear@0
|
906 }
|
nuclear@0
|
907
|
nuclear@0
|
908 //! Specifies which materials are used
|
nuclear@0
|
909 std::vector<bool> abNeedMaterials;
|
nuclear@0
|
910
|
nuclear@0
|
911 //! List of all materials
|
nuclear@0
|
912 std::vector<aiMaterial*> pcMats;
|
nuclear@0
|
913
|
nuclear@0
|
914 //! List of all bones
|
nuclear@0
|
915 IntBone_MDL7** apcOutBones;
|
nuclear@0
|
916
|
nuclear@0
|
917 //! number of bones
|
nuclear@0
|
918 unsigned int iNum;
|
nuclear@0
|
919 };
|
nuclear@0
|
920
|
nuclear@0
|
921 // -------------------------------------------------------------------------------------
|
nuclear@0
|
922 //! Contains input data for GenerateOutputMeshes_3DGS_MDL7
|
nuclear@0
|
923 struct IntSplitGroupData_MDL7
|
nuclear@0
|
924 {
|
nuclear@0
|
925 //! Construction from a given shared data set
|
nuclear@0
|
926 IntSplitGroupData_MDL7(IntSharedData_MDL7& _shared,
|
nuclear@0
|
927 std::vector<aiMesh*>& _avOutList)
|
nuclear@0
|
928
|
nuclear@0
|
929 : shared(_shared), avOutList(_avOutList)
|
nuclear@0
|
930 {
|
nuclear@0
|
931 }
|
nuclear@0
|
932
|
nuclear@0
|
933 //! Destruction: properly delete all allocated resources
|
nuclear@0
|
934 ~IntSplitGroupData_MDL7()
|
nuclear@0
|
935 {
|
nuclear@0
|
936 // kill all face lists
|
nuclear@0
|
937 if(this->aiSplit)
|
nuclear@0
|
938 {
|
nuclear@0
|
939 for (unsigned int m = 0; m < shared.pcMats.size();++m)
|
nuclear@0
|
940 delete this->aiSplit[m];
|
nuclear@0
|
941 delete[] this->aiSplit;
|
nuclear@0
|
942 }
|
nuclear@0
|
943 }
|
nuclear@0
|
944
|
nuclear@0
|
945 //! Contains a list of all faces per material
|
nuclear@0
|
946 std::vector<unsigned int>** aiSplit;
|
nuclear@0
|
947
|
nuclear@0
|
948 //! Shared data for all groups of the model
|
nuclear@0
|
949 IntSharedData_MDL7& shared;
|
nuclear@0
|
950
|
nuclear@0
|
951 //! List of meshes
|
nuclear@0
|
952 std::vector<aiMesh*>& avOutList;
|
nuclear@0
|
953 };
|
nuclear@0
|
954
|
nuclear@0
|
955
|
nuclear@0
|
956 }
|
nuclear@0
|
957 } // end namespaces
|
nuclear@0
|
958
|
nuclear@0
|
959 #endif // !! AI_MDLFILEHELPER_H_INC
|