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 /** @file MDLLoader.h
|
nuclear@0
|
43 * @brief Declaration of the loader for MDL files
|
nuclear@0
|
44 */
|
nuclear@0
|
45
|
nuclear@0
|
46 #ifndef AI_MDLLOADER_H_INCLUDED
|
nuclear@0
|
47 #define AI_MDLLOADER_H_INCLUDED
|
nuclear@0
|
48
|
nuclear@0
|
49 #include "BaseImporter.h"
|
nuclear@0
|
50
|
nuclear@0
|
51 struct aiNode;
|
nuclear@0
|
52 #include "MDLFileData.h"
|
nuclear@0
|
53 #include "HalfLifeFileData.h"
|
nuclear@0
|
54
|
nuclear@0
|
55 namespace Assimp {
|
nuclear@0
|
56
|
nuclear@0
|
57
|
nuclear@0
|
58 using namespace MDL;
|
nuclear@0
|
59
|
nuclear@0
|
60 // --------------------------------------------------------------------------------------
|
nuclear@0
|
61 // Include file/line information in debug builds
|
nuclear@0
|
62 #ifdef ASSIMP_BUILD_DEBUG
|
nuclear@0
|
63 # define VALIDATE_FILE_SIZE(msg) SizeCheck(msg,__FILE__,__LINE__)
|
nuclear@0
|
64 #else
|
nuclear@0
|
65 # define VALIDATE_FILE_SIZE(msg) SizeCheck(msg)
|
nuclear@0
|
66 #endif
|
nuclear@0
|
67
|
nuclear@0
|
68 // --------------------------------------------------------------------------------------
|
nuclear@0
|
69 /** @brief Class to load MDL files.
|
nuclear@0
|
70 *
|
nuclear@0
|
71 * Several subformats exist:
|
nuclear@0
|
72 * <ul>
|
nuclear@0
|
73 * <li>Quake I</li>
|
nuclear@0
|
74 * <li>3D Game Studio MDL3, MDL4</li>
|
nuclear@0
|
75 * <li>3D Game Studio MDL5</li>
|
nuclear@0
|
76 * <li>3D Game Studio MDL7</li>
|
nuclear@0
|
77 * <li>Halflife 2</li>
|
nuclear@0
|
78 * </ul>
|
nuclear@0
|
79 * These formats are partially identical and it would be possible to load
|
nuclear@0
|
80 * them all with a single 1000-line function-beast. However, it has been
|
nuclear@0
|
81 * split into several code paths to make the code easier to read and maintain.
|
nuclear@0
|
82 */
|
nuclear@0
|
83 class MDLImporter : public BaseImporter
|
nuclear@0
|
84 {
|
nuclear@0
|
85 public:
|
nuclear@0
|
86 MDLImporter();
|
nuclear@0
|
87 ~MDLImporter();
|
nuclear@0
|
88
|
nuclear@0
|
89
|
nuclear@0
|
90 public:
|
nuclear@0
|
91
|
nuclear@0
|
92 // -------------------------------------------------------------------
|
nuclear@0
|
93 /** Returns whether the class can handle the format of the given file.
|
nuclear@0
|
94 * See BaseImporter::CanRead() for details. */
|
nuclear@0
|
95 bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
|
nuclear@0
|
96 bool checkSig) const;
|
nuclear@0
|
97
|
nuclear@0
|
98
|
nuclear@0
|
99 // -------------------------------------------------------------------
|
nuclear@0
|
100 /** Called prior to ReadFile().
|
nuclear@0
|
101 * The function is a request to the importer to update its configuration
|
nuclear@0
|
102 * basing on the Importer's configuration property list.
|
nuclear@0
|
103 */
|
nuclear@0
|
104 void SetupProperties(const Importer* pImp);
|
nuclear@0
|
105
|
nuclear@0
|
106 protected:
|
nuclear@0
|
107
|
nuclear@0
|
108
|
nuclear@0
|
109 // -------------------------------------------------------------------
|
nuclear@0
|
110 /** Return importer meta information.
|
nuclear@0
|
111 * See #BaseImporter::GetInfo for the details
|
nuclear@0
|
112 */
|
nuclear@0
|
113 const aiImporterDesc* GetInfo () const;
|
nuclear@0
|
114
|
nuclear@0
|
115 // -------------------------------------------------------------------
|
nuclear@0
|
116 /** Imports the given file into the given scene structure.
|
nuclear@0
|
117 * See BaseImporter::InternReadFile() for details
|
nuclear@0
|
118 */
|
nuclear@0
|
119 void InternReadFile( const std::string& pFile, aiScene* pScene,
|
nuclear@0
|
120 IOSystem* pIOHandler);
|
nuclear@0
|
121
|
nuclear@0
|
122 protected:
|
nuclear@0
|
123
|
nuclear@0
|
124 // -------------------------------------------------------------------
|
nuclear@0
|
125 /** Import a quake 1 MDL file (IDPO)
|
nuclear@0
|
126 */
|
nuclear@0
|
127 void InternReadFile_Quake1( );
|
nuclear@0
|
128
|
nuclear@0
|
129 // -------------------------------------------------------------------
|
nuclear@0
|
130 /** Import a GameStudio A4/A5 file (MDL 3,4,5)
|
nuclear@0
|
131 */
|
nuclear@0
|
132 void InternReadFile_3DGS_MDL345( );
|
nuclear@0
|
133
|
nuclear@0
|
134 // -------------------------------------------------------------------
|
nuclear@0
|
135 /** Import a GameStudio A7 file (MDL 7)
|
nuclear@0
|
136 */
|
nuclear@0
|
137 void InternReadFile_3DGS_MDL7( );
|
nuclear@0
|
138
|
nuclear@0
|
139 // -------------------------------------------------------------------
|
nuclear@0
|
140 /** Import a CS:S/HL2 MDL file (not fully implemented)
|
nuclear@0
|
141 */
|
nuclear@0
|
142 void InternReadFile_HL2( );
|
nuclear@0
|
143
|
nuclear@0
|
144 // -------------------------------------------------------------------
|
nuclear@0
|
145 /** Check whether a given position is inside the valid range
|
nuclear@0
|
146 * Throw a DeadlyImportError if it is not
|
nuclear@0
|
147 * \param szPos Cursor position
|
nuclear@0
|
148 * \param szFile Name of the source file from which the function was called
|
nuclear@0
|
149 * \param iLine Source code line from which the function was called
|
nuclear@0
|
150 */
|
nuclear@0
|
151 void SizeCheck(const void* szPos);
|
nuclear@0
|
152 void SizeCheck(const void* szPos, const char* szFile, unsigned int iLine);
|
nuclear@0
|
153
|
nuclear@0
|
154
|
nuclear@0
|
155 // -------------------------------------------------------------------
|
nuclear@0
|
156 /** Validate the header data structure of a game studio MDL7 file
|
nuclear@0
|
157 * \param pcHeader Input header to be validated
|
nuclear@0
|
158 */
|
nuclear@0
|
159 void ValidateHeader_3DGS_MDL7(const MDL::Header_MDL7* pcHeader);
|
nuclear@0
|
160
|
nuclear@0
|
161 // -------------------------------------------------------------------
|
nuclear@0
|
162 /** Validate the header data structure of a Quake 1 model
|
nuclear@0
|
163 * \param pcHeader Input header to be validated
|
nuclear@0
|
164 */
|
nuclear@0
|
165 void ValidateHeader_Quake1(const MDL::Header* pcHeader);
|
nuclear@0
|
166
|
nuclear@0
|
167
|
nuclear@0
|
168 // -------------------------------------------------------------------
|
nuclear@0
|
169 /** Try to load a palette from the current directory (colormap.lmp)
|
nuclear@0
|
170 * If it is not found the default palette of Quake1 is returned
|
nuclear@0
|
171 */
|
nuclear@0
|
172 void SearchPalette(const unsigned char** pszColorMap);
|
nuclear@0
|
173
|
nuclear@0
|
174 // -------------------------------------------------------------------
|
nuclear@0
|
175 /** Free a palette created with a previous call to SearchPalette()
|
nuclear@0
|
176 */
|
nuclear@0
|
177 void FreePalette(const unsigned char* pszColorMap);
|
nuclear@0
|
178
|
nuclear@0
|
179
|
nuclear@0
|
180 // -------------------------------------------------------------------
|
nuclear@0
|
181 /** Load a paletized texture from the file and convert it to 32bpp
|
nuclear@0
|
182 */
|
nuclear@0
|
183 void CreateTextureARGB8_3DGS_MDL3(const unsigned char* szData);
|
nuclear@0
|
184
|
nuclear@0
|
185 // -------------------------------------------------------------------
|
nuclear@0
|
186 /** Used to load textures from MDL3/4
|
nuclear@0
|
187 * \param szData Input data
|
nuclear@0
|
188 * \param iType Color data type
|
nuclear@0
|
189 * \param piSkip Receive: Size to skip, in bytes
|
nuclear@0
|
190 */
|
nuclear@0
|
191 void CreateTexture_3DGS_MDL4(const unsigned char* szData,
|
nuclear@0
|
192 unsigned int iType,
|
nuclear@0
|
193 unsigned int* piSkip);
|
nuclear@0
|
194
|
nuclear@0
|
195
|
nuclear@0
|
196 // -------------------------------------------------------------------
|
nuclear@0
|
197 /** Used to load textures from MDL5
|
nuclear@0
|
198 * \param szData Input data
|
nuclear@0
|
199 * \param iType Color data type
|
nuclear@0
|
200 * \param piSkip Receive: Size to skip, in bytes
|
nuclear@0
|
201 */
|
nuclear@0
|
202 void CreateTexture_3DGS_MDL5(const unsigned char* szData,
|
nuclear@0
|
203 unsigned int iType,
|
nuclear@0
|
204 unsigned int* piSkip);
|
nuclear@0
|
205
|
nuclear@0
|
206
|
nuclear@0
|
207 // -------------------------------------------------------------------
|
nuclear@0
|
208 /** Checks whether a texture can be replaced with a single color
|
nuclear@0
|
209 * This is useful for all file formats before MDL7 (all those
|
nuclear@0
|
210 * that are not containing material colors separate from textures).
|
nuclear@0
|
211 * MED seems to write dummy 8x8 monochrome images instead.
|
nuclear@0
|
212 * \param pcTexture Input texture
|
nuclear@0
|
213 * \return aiColor.r is set to qnan if the function fails and no
|
nuclear@0
|
214 * color can be found.
|
nuclear@0
|
215 */
|
nuclear@0
|
216 aiColor4D ReplaceTextureWithColor(const aiTexture* pcTexture);
|
nuclear@0
|
217
|
nuclear@0
|
218
|
nuclear@0
|
219 // -------------------------------------------------------------------
|
nuclear@0
|
220 /** Converts the absolute texture coordinates in MDL5 files to
|
nuclear@0
|
221 * relative in a range between 0 and 1
|
nuclear@0
|
222 */
|
nuclear@0
|
223 void CalculateUVCoordinates_MDL5();
|
nuclear@0
|
224
|
nuclear@0
|
225
|
nuclear@0
|
226 // -------------------------------------------------------------------
|
nuclear@0
|
227 /** Read an UV coordinate from the file. If the file format is not
|
nuclear@0
|
228 * MDL5, the function calculates relative texture coordinates
|
nuclear@0
|
229 * \param vOut Receives the output UV coord
|
nuclear@0
|
230 * \param pcSrc UV coordinate buffer
|
nuclear@0
|
231 * \param UV coordinate index
|
nuclear@0
|
232 */
|
nuclear@0
|
233 void ImportUVCoordinate_3DGS_MDL345( aiVector3D& vOut,
|
nuclear@0
|
234 const MDL::TexCoord_MDL3* pcSrc,
|
nuclear@0
|
235 unsigned int iIndex);
|
nuclear@0
|
236
|
nuclear@0
|
237 // -------------------------------------------------------------------
|
nuclear@0
|
238 /** Setup the material properties for Quake and MDL<7 models.
|
nuclear@0
|
239 * These formats don't support more than one material per mesh,
|
nuclear@0
|
240 * therefore the method processes only ONE skin and removes
|
nuclear@0
|
241 * all others.
|
nuclear@0
|
242 */
|
nuclear@0
|
243 void SetupMaterialProperties_3DGS_MDL5_Quake1( );
|
nuclear@0
|
244
|
nuclear@0
|
245
|
nuclear@0
|
246 // -------------------------------------------------------------------
|
nuclear@0
|
247 /** Parse a skin lump in a MDL7/HMP7 file with all of its features
|
nuclear@0
|
248 * variant 1: Current cursor position is the beginning of the skin header
|
nuclear@0
|
249 * \param szCurrent Current data pointer
|
nuclear@0
|
250 * \param szCurrentOut Output data pointer
|
nuclear@0
|
251 * \param pcMats Material list for this group. To be filled ...
|
nuclear@0
|
252 */
|
nuclear@0
|
253 void ParseSkinLump_3DGS_MDL7(
|
nuclear@0
|
254 const unsigned char* szCurrent,
|
nuclear@0
|
255 const unsigned char** szCurrentOut,
|
nuclear@0
|
256 std::vector<aiMaterial*>& pcMats);
|
nuclear@0
|
257
|
nuclear@0
|
258 // -------------------------------------------------------------------
|
nuclear@0
|
259 /** Parse a skin lump in a MDL7/HMP7 file with all of its features
|
nuclear@0
|
260 * variant 2: Current cursor position is the beginning of the skin data
|
nuclear@0
|
261 * \param szCurrent Current data pointer
|
nuclear@0
|
262 * \param szCurrentOut Output data pointer
|
nuclear@0
|
263 * \param pcMatOut Output material
|
nuclear@0
|
264 * \param iType header.typ
|
nuclear@0
|
265 * \param iWidth header.width
|
nuclear@0
|
266 * \param iHeight header.height
|
nuclear@0
|
267 */
|
nuclear@0
|
268 void ParseSkinLump_3DGS_MDL7(
|
nuclear@0
|
269 const unsigned char* szCurrent,
|
nuclear@0
|
270 const unsigned char** szCurrentOut,
|
nuclear@0
|
271 aiMaterial* pcMatOut,
|
nuclear@0
|
272 unsigned int iType,
|
nuclear@0
|
273 unsigned int iWidth,
|
nuclear@0
|
274 unsigned int iHeight);
|
nuclear@0
|
275
|
nuclear@0
|
276 // -------------------------------------------------------------------
|
nuclear@0
|
277 /** Skip a skin lump in a MDL7/HMP7 file
|
nuclear@0
|
278 * \param szCurrent Current data pointer
|
nuclear@0
|
279 * \param szCurrentOut Output data pointer. Points to the byte just
|
nuclear@0
|
280 * behind the last byte of the skin.
|
nuclear@0
|
281 * \param iType header.typ
|
nuclear@0
|
282 * \param iWidth header.width
|
nuclear@0
|
283 * \param iHeight header.height
|
nuclear@0
|
284 */
|
nuclear@0
|
285 void SkipSkinLump_3DGS_MDL7(const unsigned char* szCurrent,
|
nuclear@0
|
286 const unsigned char** szCurrentOut,
|
nuclear@0
|
287 unsigned int iType,
|
nuclear@0
|
288 unsigned int iWidth,
|
nuclear@0
|
289 unsigned int iHeight);
|
nuclear@0
|
290
|
nuclear@0
|
291 // -------------------------------------------------------------------
|
nuclear@0
|
292 /** Parse texture color data for MDL5, MDL6 and MDL7 formats
|
nuclear@0
|
293 * \param szData Current data pointer
|
nuclear@0
|
294 * \param iType type of the texture data. No DDS or external
|
nuclear@0
|
295 * \param piSkip Receive the number of bytes to skip
|
nuclear@0
|
296 * \param pcNew Must point to fully initialized data. Width and
|
nuclear@0
|
297 * height must be set. If pcNew->pcData is set to UINT_MAX,
|
nuclear@0
|
298 * piSkip will receive the size of the texture, in bytes, but no
|
nuclear@0
|
299 * color data will be read.
|
nuclear@0
|
300 */
|
nuclear@0
|
301 void ParseTextureColorData(const unsigned char* szData,
|
nuclear@0
|
302 unsigned int iType,
|
nuclear@0
|
303 unsigned int* piSkip,
|
nuclear@0
|
304 aiTexture* pcNew);
|
nuclear@0
|
305
|
nuclear@0
|
306 // -------------------------------------------------------------------
|
nuclear@0
|
307 /** Join two materials / skins. Setup UV source ... etc
|
nuclear@0
|
308 * \param pcMat1 First input material
|
nuclear@0
|
309 * \param pcMat2 Second input material
|
nuclear@0
|
310 * \param pcMatOut Output material instance to be filled. Must be empty
|
nuclear@0
|
311 */
|
nuclear@0
|
312 void JoinSkins_3DGS_MDL7(aiMaterial* pcMat1,
|
nuclear@0
|
313 aiMaterial* pcMat2,
|
nuclear@0
|
314 aiMaterial* pcMatOut);
|
nuclear@0
|
315
|
nuclear@0
|
316 // -------------------------------------------------------------------
|
nuclear@0
|
317 /** Add a bone transformation key to an animation
|
nuclear@0
|
318 * \param iTrafo Index of the transformation (always==frame index?)
|
nuclear@0
|
319 * No need to validate this index, it is always valid.
|
nuclear@0
|
320 * \param pcBoneTransforms Bone transformation for this index
|
nuclear@0
|
321 * \param apcOutBones Output bones array
|
nuclear@0
|
322 */
|
nuclear@0
|
323 void AddAnimationBoneTrafoKey_3DGS_MDL7(unsigned int iTrafo,
|
nuclear@0
|
324 const MDL::BoneTransform_MDL7* pcBoneTransforms,
|
nuclear@0
|
325 MDL::IntBone_MDL7** apcBonesOut);
|
nuclear@0
|
326
|
nuclear@0
|
327 // -------------------------------------------------------------------
|
nuclear@0
|
328 /** Load the bone list of a MDL7 file
|
nuclear@0
|
329 * \return If the bones could be loaded successfully, a valid
|
nuclear@0
|
330 * array containing pointers to a temporary bone
|
nuclear@0
|
331 * representation. NULL if the bones could not be loaded.
|
nuclear@0
|
332 */
|
nuclear@0
|
333 MDL::IntBone_MDL7** LoadBones_3DGS_MDL7();
|
nuclear@0
|
334
|
nuclear@0
|
335 // -------------------------------------------------------------------
|
nuclear@0
|
336 /** Load bone transformation keyframes from a file chunk
|
nuclear@0
|
337 * \param groupInfo -> doc of data structure
|
nuclear@0
|
338 * \param frame -> doc of data structure
|
nuclear@0
|
339 * \param shared -> doc of data structure
|
nuclear@0
|
340 */
|
nuclear@0
|
341 void ParseBoneTrafoKeys_3DGS_MDL7(
|
nuclear@0
|
342 const MDL::IntGroupInfo_MDL7& groupInfo,
|
nuclear@0
|
343 IntFrameInfo_MDL7& frame,
|
nuclear@0
|
344 MDL::IntSharedData_MDL7& shared);
|
nuclear@0
|
345
|
nuclear@0
|
346 // -------------------------------------------------------------------
|
nuclear@0
|
347 /** Calculate absolute bone animation matrices for each bone
|
nuclear@0
|
348 * \param apcOutBones Output bones array
|
nuclear@0
|
349 */
|
nuclear@0
|
350 void CalcAbsBoneMatrices_3DGS_MDL7(MDL::IntBone_MDL7** apcOutBones);
|
nuclear@0
|
351
|
nuclear@0
|
352 // -------------------------------------------------------------------
|
nuclear@0
|
353 /** Add all bones to the nodegraph (as children of the root node)
|
nuclear@0
|
354 * \param apcBonesOut List of bones
|
nuclear@0
|
355 * \param pcParent Parent node. New nodes will be added to this node
|
nuclear@0
|
356 * \param iParentIndex Index of the parent bone
|
nuclear@0
|
357 */
|
nuclear@0
|
358 void AddBonesToNodeGraph_3DGS_MDL7(const MDL::IntBone_MDL7** apcBonesOut,
|
nuclear@0
|
359 aiNode* pcParent,uint16_t iParentIndex);
|
nuclear@0
|
360
|
nuclear@0
|
361 // -------------------------------------------------------------------
|
nuclear@0
|
362 /** Build output animations
|
nuclear@0
|
363 * \param apcBonesOut List of bones
|
nuclear@0
|
364 */
|
nuclear@0
|
365 void BuildOutputAnims_3DGS_MDL7(const MDL::IntBone_MDL7** apcBonesOut);
|
nuclear@0
|
366
|
nuclear@0
|
367 // -------------------------------------------------------------------
|
nuclear@0
|
368 /** Handles materials that are just referencing another material
|
nuclear@0
|
369 * There is no test file for this feature, but Conitec's doc
|
nuclear@0
|
370 * say it is used.
|
nuclear@0
|
371 */
|
nuclear@0
|
372 void HandleMaterialReferences_3DGS_MDL7();
|
nuclear@0
|
373
|
nuclear@0
|
374 // -------------------------------------------------------------------
|
nuclear@0
|
375 /** Copies only the material that are referenced by at least one
|
nuclear@0
|
376 * mesh to the final output material list. All other materials
|
nuclear@0
|
377 * will be discarded.
|
nuclear@0
|
378 * \param shared -> doc of data structure
|
nuclear@0
|
379 */
|
nuclear@0
|
380 void CopyMaterials_3DGS_MDL7(MDL::IntSharedData_MDL7 &shared);
|
nuclear@0
|
381
|
nuclear@0
|
382 // -------------------------------------------------------------------
|
nuclear@0
|
383 /** Process the frame section at the end of a group
|
nuclear@0
|
384 * \param groupInfo -> doc of data structure
|
nuclear@0
|
385 * \param shared -> doc of data structure
|
nuclear@0
|
386 * \param szCurrent Pointer to the start of the frame section
|
nuclear@0
|
387 * \param szCurrentOut Receives a pointer to the first byte of the
|
nuclear@0
|
388 * next data section.
|
nuclear@0
|
389 * \return false to read no further groups (a small workaround for
|
nuclear@0
|
390 * some tiny and unsolved problems ... )
|
nuclear@0
|
391 */
|
nuclear@0
|
392 bool ProcessFrames_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
|
nuclear@0
|
393 MDL::IntGroupData_MDL7& groupData,
|
nuclear@0
|
394 MDL::IntSharedData_MDL7& shared,
|
nuclear@0
|
395 const unsigned char* szCurrent,
|
nuclear@0
|
396 const unsigned char** szCurrentOut);
|
nuclear@0
|
397
|
nuclear@0
|
398 // -------------------------------------------------------------------
|
nuclear@0
|
399 /** Sort all faces by their materials. If the mesh is using
|
nuclear@0
|
400 * multiple materials per face (that are blended together) the function
|
nuclear@0
|
401 * might create new materials.
|
nuclear@0
|
402 * \param groupInfo -> doc of data structure
|
nuclear@0
|
403 * \param groupData -> doc of data structure
|
nuclear@0
|
404 * \param splitGroupData -> doc of data structure
|
nuclear@0
|
405 */
|
nuclear@0
|
406 void SortByMaterials_3DGS_MDL7(
|
nuclear@0
|
407 const MDL::IntGroupInfo_MDL7& groupInfo,
|
nuclear@0
|
408 MDL::IntGroupData_MDL7& groupData,
|
nuclear@0
|
409 MDL::IntSplitGroupData_MDL7& splitGroupData);
|
nuclear@0
|
410
|
nuclear@0
|
411 // -------------------------------------------------------------------
|
nuclear@0
|
412 /** Read all faces and vertices from a MDL7 group. The function fills
|
nuclear@0
|
413 * preallocated memory buffers.
|
nuclear@0
|
414 * \param groupInfo -> doc of data structure
|
nuclear@0
|
415 * \param groupData -> doc of data structure
|
nuclear@0
|
416 */
|
nuclear@0
|
417 void ReadFaces_3DGS_MDL7(const MDL::IntGroupInfo_MDL7& groupInfo,
|
nuclear@0
|
418 MDL::IntGroupData_MDL7& groupData);
|
nuclear@0
|
419
|
nuclear@0
|
420 // -------------------------------------------------------------------
|
nuclear@0
|
421 /** Generate the final output meshes for a7 models
|
nuclear@0
|
422 * \param groupData -> doc of data structure
|
nuclear@0
|
423 * \param splitGroupData -> doc of data structure
|
nuclear@0
|
424 */
|
nuclear@0
|
425 void GenerateOutputMeshes_3DGS_MDL7(
|
nuclear@0
|
426 MDL::IntGroupData_MDL7& groupData,
|
nuclear@0
|
427 MDL::IntSplitGroupData_MDL7& splitGroupData);
|
nuclear@0
|
428
|
nuclear@0
|
429 protected:
|
nuclear@0
|
430
|
nuclear@0
|
431 /** Configuration option: frame to be loaded */
|
nuclear@0
|
432 unsigned int configFrameID;
|
nuclear@0
|
433
|
nuclear@0
|
434 /** Configuration option: palette to be used to decode palletized images*/
|
nuclear@0
|
435 std::string configPalette;
|
nuclear@0
|
436
|
nuclear@0
|
437 /** Buffer to hold the loaded file */
|
nuclear@0
|
438 unsigned char* mBuffer;
|
nuclear@0
|
439
|
nuclear@0
|
440 /** For GameStudio MDL files: The number in the magic word, either 3,4 or 5
|
nuclear@0
|
441 * (MDL7 doesn't need this, the format has a separate loader) */
|
nuclear@0
|
442 unsigned int iGSFileVersion;
|
nuclear@0
|
443
|
nuclear@0
|
444 /** Output I/O handler. used to load external lmp files */
|
nuclear@0
|
445 IOSystem* pIOHandler;
|
nuclear@0
|
446
|
nuclear@0
|
447 /** Output scene to be filled */
|
nuclear@0
|
448 aiScene* pScene;
|
nuclear@0
|
449
|
nuclear@0
|
450 /** Size of the input file in bytes */
|
nuclear@0
|
451 unsigned int iFileSize;
|
nuclear@0
|
452 };
|
nuclear@0
|
453
|
nuclear@0
|
454 } // end of namespace Assimp
|
nuclear@0
|
455
|
nuclear@0
|
456 #endif // AI_3DSIMPORTER_H_INC
|