/src/assimp/code/AssetLib/ASE/ASEParser.h
Line | Count | Source |
1 | | /* |
2 | | Open Asset Import Library (assimp) |
3 | | ---------------------------------------------------------------------- |
4 | | |
5 | | Copyright (c) 2006-2025, 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 | | /** @file Defines the helper data structures for importing ASE files */ |
43 | | #ifndef AI_ASEFILEHELPER_H_INC |
44 | | #define AI_ASEFILEHELPER_H_INC |
45 | | |
46 | | // public ASSIMP headers |
47 | | #include <assimp/anim.h> |
48 | | #include <assimp/mesh.h> |
49 | | #include <assimp/types.h> |
50 | | |
51 | | #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER |
52 | | |
53 | | // for some helper routines like IsSpace() |
54 | | #include <assimp/ParsingUtils.h> |
55 | | #include <assimp/qnan.h> |
56 | | |
57 | | // ASE is quite similar to 3ds. We can reuse some structures |
58 | | #include "AssetLib/3DS/3DSLoader.h" |
59 | | |
60 | | namespace Assimp::ASE { |
61 | | |
62 | | using namespace D3DS; |
63 | | |
64 | | // --------------------------------------------------------------------------- |
65 | | /** Helper structure representing an ASE material */ |
66 | | struct Material final : D3DS::Material { |
67 | | //! Default constructor has been deleted |
68 | | Material() = delete; |
69 | | |
70 | | //! Constructor with explicit name |
71 | | explicit Material(const std::string &name) : |
72 | 9 | D3DS::Material(name), |
73 | 9 | pcInstance(nullptr), |
74 | 9 | bNeed(false) { |
75 | | // empty |
76 | 9 | } |
77 | | |
78 | 7 | Material(const Material &other) = default; |
79 | | |
80 | 0 | Material &operator=(const Material &other) { |
81 | 0 | if (this == &other) { |
82 | 0 | return *this; |
83 | 0 | } |
84 | 0 |
|
85 | 0 | avSubMaterials = other.avSubMaterials; |
86 | 0 | pcInstance = other.pcInstance; |
87 | 0 | bNeed = other.bNeed; |
88 | 0 |
|
89 | 0 | return *this; |
90 | 0 | } |
91 | | |
92 | | //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it |
93 | | Material(Material &&other) AI_NO_EXCEPT |
94 | 7 | : D3DS::Material(std::move(other)), |
95 | 7 | avSubMaterials(std::move(other.avSubMaterials)), |
96 | 7 | pcInstance(other.pcInstance), |
97 | 7 | bNeed(other.bNeed) { |
98 | 7 | other.pcInstance = nullptr; |
99 | 7 | } |
100 | | |
101 | 0 | Material &operator=(Material &&other) AI_NO_EXCEPT { |
102 | 0 | if (this == &other) { |
103 | 0 | return *this; |
104 | 0 | } |
105 | 0 |
|
106 | 0 | //D3DS::Material::operator=(std::move(other)); |
107 | 0 |
|
108 | 0 | avSubMaterials = std::move(other.avSubMaterials); |
109 | 0 | pcInstance = other.pcInstance; |
110 | 0 | bNeed = other.bNeed; |
111 | 0 |
|
112 | 0 | other.pcInstance = nullptr; |
113 | 0 |
|
114 | 0 | return *this; |
115 | 0 | } |
116 | | |
117 | 23 | ~Material() override = default; |
118 | | |
119 | | //! Contains all sub materials of this material |
120 | | std::vector<Material> avSubMaterials; |
121 | | |
122 | | //! aiMaterial object |
123 | | aiMaterial *pcInstance; |
124 | | |
125 | | //! Can we remove this material? |
126 | | bool bNeed; |
127 | | }; |
128 | | |
129 | | // --------------------------------------------------------------------------- |
130 | | /** Helper structure to represent an ASE file face */ |
131 | | struct Face : public FaceWithSmoothingGroup { |
132 | | //! Default constructor. Initializes everything with 0 |
133 | | Face() AI_NO_EXCEPT |
134 | 1.01k | : iMaterial(DEFAULT_MATINDEX), |
135 | 1.01k | iFace(0) { |
136 | | // empty |
137 | 1.01k | } |
138 | | |
139 | | //! special value to indicate that no material index has |
140 | | //! been assigned to a face. The default material index |
141 | | //! will replace this value later. |
142 | | static const unsigned int DEFAULT_MATINDEX = 0xFFFFFFFF; |
143 | | |
144 | | //! Indices into each list of texture coordinates |
145 | | unsigned int amUVIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS][3]; |
146 | | |
147 | | //! Index into the list of vertex colors |
148 | | unsigned int mColorIndices[3]; |
149 | | |
150 | | //! (Sub)Material index to be assigned to this face |
151 | | unsigned int iMaterial; |
152 | | |
153 | | //! Index of the face. It is not specified whether it is |
154 | | //! a requirement of the file format that all faces are |
155 | | //! written in sequential order, so we have to expect this case |
156 | | unsigned int iFace; |
157 | | }; |
158 | | |
159 | | // --------------------------------------------------------------------------- |
160 | | /** Helper structure to represent an ASE file bone */ |
161 | | struct Bone { |
162 | | //! Constructor |
163 | | Bone() = delete; |
164 | | |
165 | | //! Construction from an existing name |
166 | | explicit Bone(const std::string &name) : |
167 | 14 | mName(name) { |
168 | | // empty |
169 | 14 | } |
170 | | |
171 | | //! Name of the bone |
172 | | std::string mName; |
173 | | }; |
174 | | |
175 | | // --------------------------------------------------------------------------- |
176 | | /** Helper structure to represent an ASE file bone vertex */ |
177 | | struct BoneVertex { |
178 | | //! Bone and corresponding vertex weight. |
179 | | //! -1 for unrequired bones .... |
180 | | std::vector<std::pair<int, float>> mBoneWeights; |
181 | | }; |
182 | | |
183 | | // --------------------------------------------------------------------------- |
184 | | /** Helper structure to represent an ASE file animation */ |
185 | | struct Animation { |
186 | | enum Type { |
187 | | TRACK = 0x0, |
188 | | BEZIER = 0x1, |
189 | | TCB = 0x2 |
190 | | } mRotationType, |
191 | | mScalingType, mPositionType; |
192 | | |
193 | | Animation() AI_NO_EXCEPT |
194 | 496 | : mRotationType(TRACK), |
195 | 496 | mScalingType(TRACK), |
196 | 496 | mPositionType(TRACK) { |
197 | | // empty |
198 | 496 | } |
199 | | |
200 | | //! List of track rotation keyframes |
201 | | std::vector<aiQuatKey> akeyRotations; |
202 | | |
203 | | //! List of track position keyframes |
204 | | std::vector<aiVectorKey> akeyPositions; |
205 | | |
206 | | //! List of track scaling keyframes |
207 | | std::vector<aiVectorKey> akeyScaling; |
208 | | }; |
209 | | |
210 | | // --------------------------------------------------------------------------- |
211 | | /** Helper structure to represent the inheritance information of an ASE node */ |
212 | | struct InheritanceInfo { |
213 | | //! Default constructor |
214 | 248 | InheritanceInfo() AI_NO_EXCEPT { |
215 | 992 | for (size_t i = 0; i < 3; ++i) { |
216 | 744 | abInheritPosition[i] = abInheritRotation[i] = abInheritScaling[i] = true; |
217 | 744 | } |
218 | 248 | } |
219 | | |
220 | | //! Inherit the parent's position?, axis order is x,y,z |
221 | | bool abInheritPosition[3]; |
222 | | |
223 | | //! Inherit the parent's rotation?, axis order is x,y,z |
224 | | bool abInheritRotation[3]; |
225 | | |
226 | | //! Inherit the parent's scaling?, axis order is x,y,z |
227 | | bool abInheritScaling[3]; |
228 | | }; |
229 | | |
230 | | // --------------------------------------------------------------------------- |
231 | | /** Represents an ASE file node. Base class for mesh, light and cameras */ |
232 | | struct BaseNode { |
233 | | enum Type { |
234 | | Light, |
235 | | Camera, |
236 | | Mesh, |
237 | | Dummy |
238 | | } mType; |
239 | | |
240 | | //! Construction from an existing name |
241 | | BaseNode(Type _mType, const std::string &name) : |
242 | 248 | mType(_mType), mName(name), mProcessed(false) { |
243 | | // Set mTargetPosition to qnan |
244 | 248 | const ai_real qnan = get_qnan(); |
245 | 248 | mTargetPosition.x = qnan; |
246 | 248 | } |
247 | | |
248 | | //! Name of the mesh |
249 | | std::string mName; |
250 | | |
251 | | //! Name of the parent of the node |
252 | | //! "" if there is no parent ... |
253 | | std::string mParent; |
254 | | |
255 | | //! Transformation matrix of the node |
256 | | aiMatrix4x4 mTransform; |
257 | | |
258 | | //! Target position (target lights and cameras) |
259 | | aiVector3D mTargetPosition; |
260 | | |
261 | | //! Specifies which axes transformations a node inherits |
262 | | //! from its parent ... |
263 | | InheritanceInfo inherit; |
264 | | |
265 | | //! Animation channels for the node |
266 | | Animation mAnim; |
267 | | |
268 | | //! Needed for lights and cameras: target animation channel |
269 | | //! Should contain position keys only. |
270 | | Animation mTargetAnim; |
271 | | |
272 | | bool mProcessed; |
273 | | }; |
274 | | |
275 | | // --------------------------------------------------------------------------- |
276 | | /** Helper structure to represent an ASE file mesh */ |
277 | | struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode { |
278 | | //! Default constructor has been deleted |
279 | | Mesh() = delete; |
280 | | |
281 | | //! Construction from an existing name |
282 | | explicit Mesh(const std::string &name) : |
283 | 21 | BaseNode(BaseNode::Mesh, name), mVertexColors(), mBoneVertices(), mBones(), iMaterialIndex(Face::DEFAULT_MATINDEX), bSkip(false) { |
284 | 189 | for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c) { |
285 | 168 | this->mNumUVComponents[c] = 2; |
286 | 168 | } |
287 | 21 | } |
288 | | |
289 | | //! List of all texture coordinate sets |
290 | | std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS]; |
291 | | |
292 | | //! List of all vertex color sets. |
293 | | std::vector<aiColor4D> mVertexColors; |
294 | | |
295 | | //! List of all bone vertices |
296 | | std::vector<BoneVertex> mBoneVertices; |
297 | | |
298 | | //! List of all bones |
299 | | std::vector<Bone> mBones; |
300 | | |
301 | | //! Material index of the mesh |
302 | | unsigned int iMaterialIndex; |
303 | | |
304 | | //! Number of vertex components for each UVW set |
305 | | unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS]; |
306 | | |
307 | | //! used internally |
308 | | bool bSkip; |
309 | | }; |
310 | | |
311 | | // --------------------------------------------------------------------------- |
312 | | /** Helper structure to represent an ASE light source */ |
313 | | struct Light : public BaseNode { |
314 | | enum LightType { |
315 | | OMNI, |
316 | | TARGET, |
317 | | FREE, |
318 | | DIRECTIONAL |
319 | | }; |
320 | | |
321 | | //! Default constructor has been deleted |
322 | | Light() = delete; |
323 | | |
324 | | //! Construction from an existing name |
325 | | explicit Light(const std::string &name) : |
326 | 1 | BaseNode(BaseNode::Light, name), mLightType(OMNI), mColor(1.f, 1.f, 1.f), mIntensity(1.f) // light is white by default |
327 | | , |
328 | 1 | mAngle(45.f), |
329 | 1 | mFalloff(0.f) { |
330 | 1 | } |
331 | | |
332 | | LightType mLightType; |
333 | | aiColor3D mColor; |
334 | | ai_real mIntensity; |
335 | | ai_real mAngle; // in degrees |
336 | | ai_real mFalloff; |
337 | | }; |
338 | | |
339 | | // --------------------------------------------------------------------------- |
340 | | /** Helper structure to represent an ASE camera */ |
341 | | struct Camera : public BaseNode { |
342 | | enum CameraType { |
343 | | FREE, |
344 | | TARGET |
345 | | }; |
346 | | |
347 | | //! Default constructor has been deleted |
348 | | Camera() = delete; |
349 | | |
350 | | //! Construction from an existing name |
351 | | explicit Camera(const std::string &name) : |
352 | 212 | BaseNode(BaseNode::Camera, name), mFOV(0.75f) // in radians |
353 | | , |
354 | 212 | mNear(0.1f), |
355 | 212 | mFar(1000.f) // could be zero |
356 | | , |
357 | 212 | mCameraType(FREE) { |
358 | 212 | } |
359 | | |
360 | | ai_real mFOV, mNear, mFar; |
361 | | CameraType mCameraType; |
362 | | }; |
363 | | |
364 | | // --------------------------------------------------------------------------- |
365 | | /** Helper structure to represent an ASE helper object (dummy) */ |
366 | | struct Dummy : public BaseNode { |
367 | | //! Constructor |
368 | | Dummy() AI_NO_EXCEPT |
369 | 14 | : BaseNode(BaseNode::Dummy, "DUMMY") { |
370 | | // empty |
371 | 14 | } |
372 | | }; |
373 | | |
374 | | // Parameters to Parser::Parse() |
375 | | static constexpr unsigned int AI_ASE_NEW_FILE_FORMAT = 200; |
376 | | static constexpr unsigned int AI_ASE_OLD_FILE_FORMAT = 110; |
377 | | |
378 | | // Internally we're a little bit more tolerant |
379 | | #define AI_ASE_IS_NEW_FILE_FORMAT() (iFileFormat >= 200) |
380 | 8.48k | #define AI_ASE_IS_OLD_FILE_FORMAT() (iFileFormat < 200) |
381 | | |
382 | | // ------------------------------------------------------------------------------- |
383 | | /** \brief Class to parse ASE files |
384 | | */ |
385 | | class Parser { |
386 | | public: |
387 | | /// @brief No default constructor. |
388 | | Parser() = delete; |
389 | | |
390 | | // ------------------------------------------------------------------- |
391 | | //! Construct a parser from a given input file which is |
392 | | //! guaranteed to be terminated with zero. |
393 | | //! @param file The name of the input file. |
394 | | //! @param fileFormatDefault Assumed file format version. If the |
395 | | //! file format is specified in the file the new value replaces |
396 | | //! the default value. |
397 | | Parser(const char *file, size_t fileLen, unsigned int fileFormatDefault); |
398 | | |
399 | | // ------------------------------------------------------------------- |
400 | | //! Parses the file into the parsers internal representation |
401 | | void Parse(); |
402 | | |
403 | | private: |
404 | | // ------------------------------------------------------------------- |
405 | | //! Parse the *SCENE block in a file |
406 | | void ParseLV1SceneBlock(); |
407 | | |
408 | | // ------------------------------------------------------------------- |
409 | | //! Parse the *MESH_SOFTSKINVERTS block in a file |
410 | | void ParseLV1SoftSkinBlock(); |
411 | | |
412 | | // ------------------------------------------------------------------- |
413 | | //! Parse the *MATERIAL_LIST block in a file |
414 | | void ParseLV1MaterialListBlock(); |
415 | | |
416 | | // ------------------------------------------------------------------- |
417 | | //! Parse a *<xxx>OBJECT block in a file |
418 | | //! \param mesh Node to be filled |
419 | | void ParseLV1ObjectBlock(BaseNode &mesh); |
420 | | |
421 | | // ------------------------------------------------------------------- |
422 | | //! Parse a *MATERIAL blocks in a material list |
423 | | //! \param mat Material structure to be filled |
424 | | void ParseLV2MaterialBlock(Material &mat); |
425 | | |
426 | | // ------------------------------------------------------------------- |
427 | | //! Parse a *NODE_TM block in a file |
428 | | //! \param mesh Node (!) object to be filled |
429 | | void ParseLV2NodeTransformBlock(BaseNode &mesh); |
430 | | |
431 | | // ------------------------------------------------------------------- |
432 | | //! Parse a *TM_ANIMATION block in a file |
433 | | //! \param mesh Mesh object to be filled |
434 | | void ParseLV2AnimationBlock(BaseNode &mesh); |
435 | | void ParseLV3PosAnimationBlock(ASE::Animation &anim); |
436 | | void ParseLV3ScaleAnimationBlock(ASE::Animation &anim); |
437 | | void ParseLV3RotAnimationBlock(ASE::Animation &anim); |
438 | | |
439 | | // ------------------------------------------------------------------- |
440 | | //! Parse a *MESH block in a file |
441 | | //! \param mesh Mesh object to be filled |
442 | | void ParseLV2MeshBlock(Mesh &mesh); |
443 | | |
444 | | // ------------------------------------------------------------------- |
445 | | //! Parse a *LIGHT_SETTINGS block in a file |
446 | | //! \param light Light object to be filled |
447 | | void ParseLV2LightSettingsBlock(Light &light); |
448 | | |
449 | | // ------------------------------------------------------------------- |
450 | | //! Parse a *CAMERA_SETTINGS block in a file |
451 | | //! \param cam Camera object to be filled |
452 | | void ParseLV2CameraSettingsBlock(Camera &cam); |
453 | | |
454 | | // ------------------------------------------------------------------- |
455 | | //! Parse the *MAP_XXXXXX blocks in a material |
456 | | //! \param map Texture structure to be filled |
457 | | void ParseLV3MapBlock(Texture &map); |
458 | | |
459 | | // ------------------------------------------------------------------- |
460 | | //! Parse a *MESH_VERTEX_LIST block in a file |
461 | | //! \param iNumVertices Value of *MESH_NUMVERTEX, if present. |
462 | | //! Otherwise zero. This is used to check the consistency of the file. |
463 | | //! A warning is sent to the logger if the validations fails. |
464 | | //! \param mesh Mesh object to be filled |
465 | | void ParseLV3MeshVertexListBlock( |
466 | | unsigned int iNumVertices, Mesh &mesh); |
467 | | |
468 | | // ------------------------------------------------------------------- |
469 | | //! Parse a *MESH_FACE_LIST block in a file |
470 | | //! \param iNumFaces Value of *MESH_NUMFACES, if present. |
471 | | //! Otherwise zero. This is used to check the consistency of the file. |
472 | | //! A warning is sent to the logger if the validations fails. |
473 | | //! \param mesh Mesh object to be filled |
474 | | void ParseLV3MeshFaceListBlock( |
475 | | unsigned int iNumFaces, Mesh &mesh); |
476 | | |
477 | | // ------------------------------------------------------------------- |
478 | | //! Parse a *MESH_TVERT_LIST block in a file |
479 | | //! \param iNumVertices Value of *MESH_NUMTVERTEX, if present. |
480 | | //! Otherwise zero. This is used to check the consistency of the file. |
481 | | //! A warning is sent to the logger if the validations fails. |
482 | | //! \param mesh Mesh object to be filled |
483 | | //! \param iChannel Output UVW channel |
484 | | void ParseLV3MeshTListBlock( |
485 | | unsigned int iNumVertices, Mesh &mesh, unsigned int iChannel = 0); |
486 | | |
487 | | // ------------------------------------------------------------------- |
488 | | //! Parse a *MESH_TFACELIST block in a file |
489 | | //! \param iNumFaces Value of *MESH_NUMTVFACES, if present. |
490 | | //! Otherwise zero. This is used to check the consistency of the file. |
491 | | //! A warning is sent to the logger if the validations fails. |
492 | | //! \param mesh Mesh object to be filled |
493 | | //! \param iChannel Output UVW channel |
494 | | void ParseLV3MeshTFaceListBlock( |
495 | | unsigned int iNumFaces, Mesh &mesh, unsigned int iChannel = 0); |
496 | | |
497 | | // ------------------------------------------------------------------- |
498 | | //! Parse an additional mapping channel |
499 | | //! (specified via *MESH_MAPPINGCHANNEL) |
500 | | //! \param iChannel Channel index to be filled |
501 | | //! \param mesh Mesh object to be filled |
502 | | void ParseLV3MappingChannel( |
503 | | unsigned int iChannel, Mesh &mesh); |
504 | | |
505 | | // ------------------------------------------------------------------- |
506 | | //! Parse a *MESH_CVERTLIST block in a file |
507 | | //! \param iNumVertices Value of *MESH_NUMCVERTEX, if present. |
508 | | //! Otherwise zero. This is used to check the consistency of the file. |
509 | | //! A warning is sent to the logger if the validations fails. |
510 | | //! \param mesh Mesh object to be filled |
511 | | void ParseLV3MeshCListBlock( |
512 | | unsigned int iNumVertices, Mesh &mesh); |
513 | | |
514 | | // ------------------------------------------------------------------- |
515 | | //! Parse a *MESH_CFACELIST block in a file |
516 | | //! \param iNumFaces Value of *MESH_NUMCVFACES, if present. |
517 | | //! Otherwise zero. This is used to check the consistency of the file. |
518 | | //! A warning is sent to the logger if the validations fails. |
519 | | //! \param mesh Mesh object to be filled |
520 | | void ParseLV3MeshCFaceListBlock( |
521 | | unsigned int iNumFaces, Mesh &mesh); |
522 | | |
523 | | // ------------------------------------------------------------------- |
524 | | //! Parse a *MESH_NORMALS block in a file |
525 | | //! \param mesh Mesh object to be filled |
526 | | void ParseLV3MeshNormalListBlock(Mesh &mesh); |
527 | | |
528 | | // ------------------------------------------------------------------- |
529 | | //! Parse a *MESH_WEIGHTSblock in a file |
530 | | //! \param mesh Mesh object to be filled |
531 | | void ParseLV3MeshWeightsBlock(Mesh &mesh); |
532 | | |
533 | | // ------------------------------------------------------------------- |
534 | | //! Parse the bone list of a file |
535 | | //! \param mesh Mesh object to be filled |
536 | | //! \param iNumBones Number of bones in the mesh |
537 | | void ParseLV4MeshBones(unsigned int iNumBones, Mesh &mesh); |
538 | | |
539 | | // ------------------------------------------------------------------- |
540 | | //! Parse the bone vertices list of a file |
541 | | //! \param mesh Mesh object to be filled |
542 | | //! \param iNumVertices Number of vertices to be parsed |
543 | | void ParseLV4MeshBonesVertices(unsigned int iNumVertices, Mesh &mesh); |
544 | | |
545 | | // ------------------------------------------------------------------- |
546 | | //! Parse a *MESH_FACE block in a file |
547 | | //! \param out receive the face data |
548 | | void ParseLV4MeshFace(ASE::Face &out); |
549 | | |
550 | | // ------------------------------------------------------------------- |
551 | | //! Parse a *MESH_VERT block in a file |
552 | | //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) |
553 | | //! \param apOut Output buffer (3 floats) |
554 | | //! \param rIndexOut Output index |
555 | | void ParseLV4MeshRealTriple(ai_real *apOut, unsigned int &rIndexOut); |
556 | | void ParseLV4MeshFloatTriple(float *apOut, unsigned int &rIndexOut); |
557 | | |
558 | | // ------------------------------------------------------------------- |
559 | | //! Parse a *MESH_VERT block in a file |
560 | | //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...) |
561 | | //! \param apOut Output buffer (3 floats) |
562 | | void ParseLV4MeshRealTriple(ai_real *apOut); |
563 | | void ParseLV4MeshFloatTriple(float *apOut); |
564 | | |
565 | | // ------------------------------------------------------------------- |
566 | | //! Parse a *MESH_TFACE block in a file |
567 | | //! (also works for MESH_CFACE) |
568 | | //! \param apOut Output buffer (3 ints) |
569 | | //! \param rIndexOut Output index |
570 | | void ParseLV4MeshLongTriple(unsigned int *apOut, unsigned int &rIndexOut); |
571 | | |
572 | | // ------------------------------------------------------------------- |
573 | | //! Parse a *MESH_TFACE block in a file |
574 | | //! (also works for MESH_CFACE) |
575 | | //! \param apOut Output buffer (3 ints) |
576 | | void ParseLV4MeshLongTriple(unsigned int *apOut); |
577 | | |
578 | | // ------------------------------------------------------------------- |
579 | | //! Parse a single float element |
580 | | //! \param fOut Output float |
581 | | void ParseLV4MeshReal(ai_real &fOut); |
582 | | void ParseLV4MeshFloat(float &fOut); |
583 | | |
584 | | // ------------------------------------------------------------------- |
585 | | //! Parse a single int element |
586 | | //! \param iOut Output integer |
587 | | void ParseLV4MeshLong(unsigned int &iOut); |
588 | | |
589 | | // ------------------------------------------------------------------- |
590 | | //! Skip everything to the next: '*' or '\0' |
591 | | bool SkipToNextToken(); |
592 | | |
593 | | // ------------------------------------------------------------------- |
594 | | //! Skip the current section until the token after the closing }. |
595 | | //! This function handles embedded subsections correctly |
596 | | bool SkipSection(); |
597 | | |
598 | | // ------------------------------------------------------------------- |
599 | | //! Output a warning to the logger |
600 | | //! \param szWarn Warn message |
601 | | void LogWarning(const char *szWarn); |
602 | | |
603 | | // ------------------------------------------------------------------- |
604 | | //! Output a message to the logger |
605 | | //! \param szWarn Message |
606 | | void LogInfo(const char *szWarn); |
607 | | |
608 | | // ------------------------------------------------------------------- |
609 | | //! Output an error to the logger |
610 | | //! \param szWarn Error message |
611 | | AI_WONT_RETURN void LogError(const char *szWarn) AI_WONT_RETURN_SUFFIX; |
612 | | |
613 | | // ------------------------------------------------------------------- |
614 | | //! Parse a string, enclosed in double quotation marks |
615 | | //! \param out Output string |
616 | | //! \param szName Name of the enclosing element -> used in error |
617 | | //! messages. |
618 | | //! \return false if an error occurred |
619 | | bool ParseString(std::string &out, const char *szName); |
620 | | |
621 | | public: |
622 | | const char *mFilePtr; ////< Pointer to current data |
623 | | const char *mEnd; ///< The end pointer of the file data |
624 | | |
625 | | //! background color to be passed to the viewer |
626 | | //! QNAN if none was found |
627 | | aiColor3D m_clrBackground; |
628 | | |
629 | | //! Base ambient color to be passed to all materials |
630 | | //! QNAN if none was found |
631 | | aiColor3D m_clrAmbient; |
632 | | |
633 | | //! List of all materials found in the file |
634 | | std::vector<Material> m_vMaterials; |
635 | | |
636 | | //! List of all meshes found in the file |
637 | | std::vector<Mesh> m_vMeshes; |
638 | | |
639 | | //! List of all dummies found in the file |
640 | | std::vector<Dummy> m_vDummies; |
641 | | |
642 | | //! List of all lights found in the file |
643 | | std::vector<Light> m_vLights; |
644 | | |
645 | | //! List of all cameras found in the file |
646 | | std::vector<Camera> m_vCameras; |
647 | | |
648 | | //! Current line in the file |
649 | | unsigned int iLineNumber; |
650 | | |
651 | | //! First frame |
652 | | unsigned int iFirstFrame; |
653 | | |
654 | | //! Last frame |
655 | | unsigned int iLastFrame; |
656 | | |
657 | | //! Frame speed - frames per second |
658 | | unsigned int iFrameSpeed; |
659 | | |
660 | | //! Ticks per frame |
661 | | unsigned int iTicksPerFrame; |
662 | | |
663 | | //! true if the last character read was an end-line character |
664 | | bool bLastWasEndLine; |
665 | | |
666 | | //! File format version |
667 | | unsigned int iFileFormat; |
668 | | }; |
669 | | |
670 | | } // Namespace Assimp::ASE |
671 | | |
672 | | #endif // ASSIMP_BUILD_NO_3DS_IMPORTER |
673 | | |
674 | | #endif // !! include guard |