ASEParser.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676
  1. /*
  2. Open Asset Import Library (assimp)
  3. ----------------------------------------------------------------------
  4. Copyright (c) 2006-2025, assimp team
  5. All rights reserved.
  6. Redistribution and use of this software in source and binary forms,
  7. with or without modification, are permitted provided that the
  8. following conditions are met:
  9. * Redistributions of source code must retain the above
  10. copyright notice, this list of conditions and the
  11. following disclaimer.
  12. * Redistributions in binary form must reproduce the above
  13. copyright notice, this list of conditions and the
  14. following disclaimer in the documentation and/or other
  15. materials provided with the distribution.
  16. * Neither the name of the assimp team, nor the names of its
  17. contributors may be used to endorse or promote products
  18. derived from this software without specific prior
  19. written permission of the assimp team.
  20. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  21. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  22. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  23. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  24. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  25. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  26. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  27. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  28. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  29. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  30. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  31. ----------------------------------------------------------------------
  32. */
  33. /** @file Defines the helper data structures for importing ASE files */
  34. #ifndef AI_ASEFILEHELPER_H_INC
  35. #define AI_ASEFILEHELPER_H_INC
  36. // public ASSIMP headers
  37. #include <assimp/anim.h>
  38. #include <assimp/mesh.h>
  39. #include <assimp/types.h>
  40. #ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
  41. // for some helper routines like IsSpace()
  42. #include <assimp/ParsingUtils.h>
  43. #include <assimp/qnan.h>
  44. // ASE is quite similar to 3ds. We can reuse some structures
  45. #include "AssetLib/3DS/3DSLoader.h"
  46. namespace Assimp {
  47. namespace ASE {
  48. using namespace D3DS;
  49. // ---------------------------------------------------------------------------
  50. /** Helper structure representing an ASE material */
  51. struct Material : public D3DS::Material {
  52. //! Default constructor has been deleted
  53. Material() = delete;
  54. //! Constructor with explicit name
  55. explicit Material(const std::string &name) :
  56. D3DS::Material(name),
  57. pcInstance(nullptr),
  58. bNeed(false) {
  59. // empty
  60. }
  61. Material(const Material &other) = default;
  62. Material &operator=(const Material &other) {
  63. if (this == &other) {
  64. return *this;
  65. }
  66. avSubMaterials = other.avSubMaterials;
  67. pcInstance = other.pcInstance;
  68. bNeed = other.bNeed;
  69. return *this;
  70. }
  71. //! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
  72. Material(Material &&other) AI_NO_EXCEPT
  73. : D3DS::Material(std::move(other)),
  74. avSubMaterials(std::move(other.avSubMaterials)),
  75. pcInstance(other.pcInstance),
  76. bNeed(other.bNeed) {
  77. other.pcInstance = nullptr;
  78. }
  79. Material &operator=(Material &&other) AI_NO_EXCEPT {
  80. if (this == &other) {
  81. return *this;
  82. }
  83. //D3DS::Material::operator=(std::move(other));
  84. avSubMaterials = std::move(other.avSubMaterials);
  85. pcInstance = other.pcInstance;
  86. bNeed = other.bNeed;
  87. other.pcInstance = nullptr;
  88. return *this;
  89. }
  90. ~Material() = default;
  91. //! Contains all sub materials of this material
  92. std::vector<Material> avSubMaterials;
  93. //! aiMaterial object
  94. aiMaterial *pcInstance;
  95. //! Can we remove this material?
  96. bool bNeed;
  97. };
  98. // ---------------------------------------------------------------------------
  99. /** Helper structure to represent an ASE file face */
  100. struct Face : public FaceWithSmoothingGroup {
  101. //! Default constructor. Initializes everything with 0
  102. Face() AI_NO_EXCEPT
  103. : iMaterial(DEFAULT_MATINDEX),
  104. iFace(0) {
  105. // empty
  106. }
  107. //! special value to indicate that no material index has
  108. //! been assigned to a face. The default material index
  109. //! will replace this value later.
  110. static const unsigned int DEFAULT_MATINDEX = 0xFFFFFFFF;
  111. //! Indices into each list of texture coordinates
  112. unsigned int amUVIndices[AI_MAX_NUMBER_OF_TEXTURECOORDS][3];
  113. //! Index into the list of vertex colors
  114. unsigned int mColorIndices[3];
  115. //! (Sub)Material index to be assigned to this face
  116. unsigned int iMaterial;
  117. //! Index of the face. It is not specified whether it is
  118. //! a requirement of the file format that all faces are
  119. //! written in sequential order, so we have to expect this case
  120. unsigned int iFace;
  121. };
  122. // ---------------------------------------------------------------------------
  123. /** Helper structure to represent an ASE file bone */
  124. struct Bone {
  125. //! Constructor
  126. Bone() = delete;
  127. //! Construction from an existing name
  128. explicit Bone(const std::string &name) :
  129. mName(name) {
  130. // empty
  131. }
  132. //! Name of the bone
  133. std::string mName;
  134. };
  135. // ---------------------------------------------------------------------------
  136. /** Helper structure to represent an ASE file bone vertex */
  137. struct BoneVertex {
  138. //! Bone and corresponding vertex weight.
  139. //! -1 for unrequired bones ....
  140. std::vector<std::pair<int, float>> mBoneWeights;
  141. };
  142. // ---------------------------------------------------------------------------
  143. /** Helper structure to represent an ASE file animation */
  144. struct Animation {
  145. enum Type {
  146. TRACK = 0x0,
  147. BEZIER = 0x1,
  148. TCB = 0x2
  149. } mRotationType,
  150. mScalingType, mPositionType;
  151. Animation() AI_NO_EXCEPT
  152. : mRotationType(TRACK),
  153. mScalingType(TRACK),
  154. mPositionType(TRACK) {
  155. // empty
  156. }
  157. //! List of track rotation keyframes
  158. std::vector<aiQuatKey> akeyRotations;
  159. //! List of track position keyframes
  160. std::vector<aiVectorKey> akeyPositions;
  161. //! List of track scaling keyframes
  162. std::vector<aiVectorKey> akeyScaling;
  163. };
  164. // ---------------------------------------------------------------------------
  165. /** Helper structure to represent the inheritance information of an ASE node */
  166. struct InheritanceInfo {
  167. //! Default constructor
  168. InheritanceInfo() AI_NO_EXCEPT {
  169. for (size_t i = 0; i < 3; ++i) {
  170. abInheritPosition[i] = abInheritRotation[i] = abInheritScaling[i] = true;
  171. }
  172. }
  173. //! Inherit the parent's position?, axis order is x,y,z
  174. bool abInheritPosition[3];
  175. //! Inherit the parent's rotation?, axis order is x,y,z
  176. bool abInheritRotation[3];
  177. //! Inherit the parent's scaling?, axis order is x,y,z
  178. bool abInheritScaling[3];
  179. };
  180. // ---------------------------------------------------------------------------
  181. /** Represents an ASE file node. Base class for mesh, light and cameras */
  182. struct BaseNode {
  183. enum Type {
  184. Light,
  185. Camera,
  186. Mesh,
  187. Dummy
  188. } mType;
  189. //! Construction from an existing name
  190. BaseNode(Type _mType, const std::string &name) :
  191. mType(_mType), mName(name), mProcessed(false) {
  192. // Set mTargetPosition to qnan
  193. const ai_real qnan = get_qnan();
  194. mTargetPosition.x = qnan;
  195. }
  196. //! Name of the mesh
  197. std::string mName;
  198. //! Name of the parent of the node
  199. //! "" if there is no parent ...
  200. std::string mParent;
  201. //! Transformation matrix of the node
  202. aiMatrix4x4 mTransform;
  203. //! Target position (target lights and cameras)
  204. aiVector3D mTargetPosition;
  205. //! Specifies which axes transformations a node inherits
  206. //! from its parent ...
  207. InheritanceInfo inherit;
  208. //! Animation channels for the node
  209. Animation mAnim;
  210. //! Needed for lights and cameras: target animation channel
  211. //! Should contain position keys only.
  212. Animation mTargetAnim;
  213. bool mProcessed;
  214. };
  215. // ---------------------------------------------------------------------------
  216. /** Helper structure to represent an ASE file mesh */
  217. struct Mesh : public MeshWithSmoothingGroups<ASE::Face>, public BaseNode {
  218. //! Default constructor has been deleted
  219. Mesh() = delete;
  220. //! Construction from an existing name
  221. explicit Mesh(const std::string &name) :
  222. BaseNode(BaseNode::Mesh, name), mVertexColors(), mBoneVertices(), mBones(), iMaterialIndex(Face::DEFAULT_MATINDEX), bSkip(false) {
  223. for (unsigned int c = 0; c < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++c) {
  224. this->mNumUVComponents[c] = 2;
  225. }
  226. }
  227. //! List of all texture coordinate sets
  228. std::vector<aiVector3D> amTexCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  229. //! List of all vertex color sets.
  230. std::vector<aiColor4D> mVertexColors;
  231. //! List of all bone vertices
  232. std::vector<BoneVertex> mBoneVertices;
  233. //! List of all bones
  234. std::vector<Bone> mBones;
  235. //! Material index of the mesh
  236. unsigned int iMaterialIndex;
  237. //! Number of vertex components for each UVW set
  238. unsigned int mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
  239. //! used internally
  240. bool bSkip;
  241. };
  242. // ---------------------------------------------------------------------------
  243. /** Helper structure to represent an ASE light source */
  244. struct Light : public BaseNode {
  245. enum LightType {
  246. OMNI,
  247. TARGET,
  248. FREE,
  249. DIRECTIONAL
  250. };
  251. //! Default constructor has been deleted
  252. Light() = delete;
  253. //! Construction from an existing name
  254. explicit Light(const std::string &name) :
  255. BaseNode(BaseNode::Light, name), mLightType(OMNI), mColor(1.f, 1.f, 1.f), mIntensity(1.f) // light is white by default
  256. ,
  257. mAngle(45.f),
  258. mFalloff(0.f) {
  259. }
  260. LightType mLightType;
  261. aiColor3D mColor;
  262. ai_real mIntensity;
  263. ai_real mAngle; // in degrees
  264. ai_real mFalloff;
  265. };
  266. // ---------------------------------------------------------------------------
  267. /** Helper structure to represent an ASE camera */
  268. struct Camera : public BaseNode {
  269. enum CameraType {
  270. FREE,
  271. TARGET
  272. };
  273. //! Default constructor has been deleted
  274. Camera() = delete;
  275. //! Construction from an existing name
  276. explicit Camera(const std::string &name) :
  277. BaseNode(BaseNode::Camera, name), mFOV(0.75f) // in radians
  278. ,
  279. mNear(0.1f),
  280. mFar(1000.f) // could be zero
  281. ,
  282. mCameraType(FREE) {
  283. }
  284. ai_real mFOV, mNear, mFar;
  285. CameraType mCameraType;
  286. };
  287. // ---------------------------------------------------------------------------
  288. /** Helper structure to represent an ASE helper object (dummy) */
  289. struct Dummy : public BaseNode {
  290. //! Constructor
  291. Dummy() AI_NO_EXCEPT
  292. : BaseNode(BaseNode::Dummy, "DUMMY") {
  293. // empty
  294. }
  295. };
  296. // Parameters to Parser::Parse()
  297. #define AI_ASE_NEW_FILE_FORMAT 200
  298. #define AI_ASE_OLD_FILE_FORMAT 110
  299. // Internally we're a little bit more tolerant
  300. #define AI_ASE_IS_NEW_FILE_FORMAT() (iFileFormat >= 200)
  301. #define AI_ASE_IS_OLD_FILE_FORMAT() (iFileFormat < 200)
  302. // -------------------------------------------------------------------------------
  303. /** \brief Class to parse ASE files
  304. */
  305. class Parser {
  306. public:
  307. /// @brief No default constructor.
  308. Parser() = delete;
  309. // -------------------------------------------------------------------
  310. //! Construct a parser from a given input file which is
  311. //! guaranteed to be terminated with zero.
  312. //! @param file The name of the input file.
  313. //! @param fileFormatDefault Assumed file format version. If the
  314. //! file format is specified in the file the new value replaces
  315. //! the default value.
  316. Parser(const char *file, size_t fileLen, unsigned int fileFormatDefault);
  317. // -------------------------------------------------------------------
  318. //! Parses the file into the parsers internal representation
  319. void Parse();
  320. private:
  321. // -------------------------------------------------------------------
  322. //! Parse the *SCENE block in a file
  323. void ParseLV1SceneBlock();
  324. // -------------------------------------------------------------------
  325. //! Parse the *MESH_SOFTSKINVERTS block in a file
  326. void ParseLV1SoftSkinBlock();
  327. // -------------------------------------------------------------------
  328. //! Parse the *MATERIAL_LIST block in a file
  329. void ParseLV1MaterialListBlock();
  330. // -------------------------------------------------------------------
  331. //! Parse a *<xxx>OBJECT block in a file
  332. //! \param mesh Node to be filled
  333. void ParseLV1ObjectBlock(BaseNode &mesh);
  334. // -------------------------------------------------------------------
  335. //! Parse a *MATERIAL blocks in a material list
  336. //! \param mat Material structure to be filled
  337. void ParseLV2MaterialBlock(Material &mat);
  338. // -------------------------------------------------------------------
  339. //! Parse a *NODE_TM block in a file
  340. //! \param mesh Node (!) object to be filled
  341. void ParseLV2NodeTransformBlock(BaseNode &mesh);
  342. // -------------------------------------------------------------------
  343. //! Parse a *TM_ANIMATION block in a file
  344. //! \param mesh Mesh object to be filled
  345. void ParseLV2AnimationBlock(BaseNode &mesh);
  346. void ParseLV3PosAnimationBlock(ASE::Animation &anim);
  347. void ParseLV3ScaleAnimationBlock(ASE::Animation &anim);
  348. void ParseLV3RotAnimationBlock(ASE::Animation &anim);
  349. // -------------------------------------------------------------------
  350. //! Parse a *MESH block in a file
  351. //! \param mesh Mesh object to be filled
  352. void ParseLV2MeshBlock(Mesh &mesh);
  353. // -------------------------------------------------------------------
  354. //! Parse a *LIGHT_SETTINGS block in a file
  355. //! \param light Light object to be filled
  356. void ParseLV2LightSettingsBlock(Light &light);
  357. // -------------------------------------------------------------------
  358. //! Parse a *CAMERA_SETTINGS block in a file
  359. //! \param cam Camera object to be filled
  360. void ParseLV2CameraSettingsBlock(Camera &cam);
  361. // -------------------------------------------------------------------
  362. //! Parse the *MAP_XXXXXX blocks in a material
  363. //! \param map Texture structure to be filled
  364. void ParseLV3MapBlock(Texture &map);
  365. // -------------------------------------------------------------------
  366. //! Parse a *MESH_VERTEX_LIST block in a file
  367. //! \param iNumVertices Value of *MESH_NUMVERTEX, if present.
  368. //! Otherwise zero. This is used to check the consistency of the file.
  369. //! A warning is sent to the logger if the validations fails.
  370. //! \param mesh Mesh object to be filled
  371. void ParseLV3MeshVertexListBlock(
  372. unsigned int iNumVertices, Mesh &mesh);
  373. // -------------------------------------------------------------------
  374. //! Parse a *MESH_FACE_LIST block in a file
  375. //! \param iNumFaces Value of *MESH_NUMFACES, if present.
  376. //! Otherwise zero. This is used to check the consistency of the file.
  377. //! A warning is sent to the logger if the validations fails.
  378. //! \param mesh Mesh object to be filled
  379. void ParseLV3MeshFaceListBlock(
  380. unsigned int iNumFaces, Mesh &mesh);
  381. // -------------------------------------------------------------------
  382. //! Parse a *MESH_TVERT_LIST block in a file
  383. //! \param iNumVertices Value of *MESH_NUMTVERTEX, if present.
  384. //! Otherwise zero. This is used to check the consistency of the file.
  385. //! A warning is sent to the logger if the validations fails.
  386. //! \param mesh Mesh object to be filled
  387. //! \param iChannel Output UVW channel
  388. void ParseLV3MeshTListBlock(
  389. unsigned int iNumVertices, Mesh &mesh, unsigned int iChannel = 0);
  390. // -------------------------------------------------------------------
  391. //! Parse a *MESH_TFACELIST block in a file
  392. //! \param iNumFaces Value of *MESH_NUMTVFACES, if present.
  393. //! Otherwise zero. This is used to check the consistency of the file.
  394. //! A warning is sent to the logger if the validations fails.
  395. //! \param mesh Mesh object to be filled
  396. //! \param iChannel Output UVW channel
  397. void ParseLV3MeshTFaceListBlock(
  398. unsigned int iNumFaces, Mesh &mesh, unsigned int iChannel = 0);
  399. // -------------------------------------------------------------------
  400. //! Parse an additional mapping channel
  401. //! (specified via *MESH_MAPPINGCHANNEL)
  402. //! \param iChannel Channel index to be filled
  403. //! \param mesh Mesh object to be filled
  404. void ParseLV3MappingChannel(
  405. unsigned int iChannel, Mesh &mesh);
  406. // -------------------------------------------------------------------
  407. //! Parse a *MESH_CVERTLIST block in a file
  408. //! \param iNumVertices Value of *MESH_NUMCVERTEX, if present.
  409. //! Otherwise zero. This is used to check the consistency of the file.
  410. //! A warning is sent to the logger if the validations fails.
  411. //! \param mesh Mesh object to be filled
  412. void ParseLV3MeshCListBlock(
  413. unsigned int iNumVertices, Mesh &mesh);
  414. // -------------------------------------------------------------------
  415. //! Parse a *MESH_CFACELIST block in a file
  416. //! \param iNumFaces Value of *MESH_NUMCVFACES, if present.
  417. //! Otherwise zero. This is used to check the consistency of the file.
  418. //! A warning is sent to the logger if the validations fails.
  419. //! \param mesh Mesh object to be filled
  420. void ParseLV3MeshCFaceListBlock(
  421. unsigned int iNumFaces, Mesh &mesh);
  422. // -------------------------------------------------------------------
  423. //! Parse a *MESH_NORMALS block in a file
  424. //! \param mesh Mesh object to be filled
  425. void ParseLV3MeshNormalListBlock(Mesh &mesh);
  426. // -------------------------------------------------------------------
  427. //! Parse a *MESH_WEIGHTSblock in a file
  428. //! \param mesh Mesh object to be filled
  429. void ParseLV3MeshWeightsBlock(Mesh &mesh);
  430. // -------------------------------------------------------------------
  431. //! Parse the bone list of a file
  432. //! \param mesh Mesh object to be filled
  433. //! \param iNumBones Number of bones in the mesh
  434. void ParseLV4MeshBones(unsigned int iNumBones, Mesh &mesh);
  435. // -------------------------------------------------------------------
  436. //! Parse the bone vertices list of a file
  437. //! \param mesh Mesh object to be filled
  438. //! \param iNumVertices Number of vertices to be parsed
  439. void ParseLV4MeshBonesVertices(unsigned int iNumVertices, Mesh &mesh);
  440. // -------------------------------------------------------------------
  441. //! Parse a *MESH_FACE block in a file
  442. //! \param out receive the face data
  443. void ParseLV4MeshFace(ASE::Face &out);
  444. // -------------------------------------------------------------------
  445. //! Parse a *MESH_VERT block in a file
  446. //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
  447. //! \param apOut Output buffer (3 floats)
  448. //! \param rIndexOut Output index
  449. void ParseLV4MeshRealTriple(ai_real *apOut, unsigned int &rIndexOut);
  450. void ParseLV4MeshFloatTriple(float *apOut, unsigned int &rIndexOut);
  451. // -------------------------------------------------------------------
  452. //! Parse a *MESH_VERT block in a file
  453. //! (also works for MESH_TVERT, MESH_CFACE, MESH_VERTCOL ...)
  454. //! \param apOut Output buffer (3 floats)
  455. void ParseLV4MeshRealTriple(ai_real *apOut);
  456. void ParseLV4MeshFloatTriple(float *apOut);
  457. // -------------------------------------------------------------------
  458. //! Parse a *MESH_TFACE block in a file
  459. //! (also works for MESH_CFACE)
  460. //! \param apOut Output buffer (3 ints)
  461. //! \param rIndexOut Output index
  462. void ParseLV4MeshLongTriple(unsigned int *apOut, unsigned int &rIndexOut);
  463. // -------------------------------------------------------------------
  464. //! Parse a *MESH_TFACE block in a file
  465. //! (also works for MESH_CFACE)
  466. //! \param apOut Output buffer (3 ints)
  467. void ParseLV4MeshLongTriple(unsigned int *apOut);
  468. // -------------------------------------------------------------------
  469. //! Parse a single float element
  470. //! \param fOut Output float
  471. void ParseLV4MeshReal(ai_real &fOut);
  472. void ParseLV4MeshFloat(float &fOut);
  473. // -------------------------------------------------------------------
  474. //! Parse a single int element
  475. //! \param iOut Output integer
  476. void ParseLV4MeshLong(unsigned int &iOut);
  477. // -------------------------------------------------------------------
  478. //! Skip everything to the next: '*' or '\0'
  479. bool SkipToNextToken();
  480. // -------------------------------------------------------------------
  481. //! Skip the current section until the token after the closing }.
  482. //! This function handles embedded subsections correctly
  483. bool SkipSection();
  484. // -------------------------------------------------------------------
  485. //! Output a warning to the logger
  486. //! \param szWarn Warn message
  487. void LogWarning(const char *szWarn);
  488. // -------------------------------------------------------------------
  489. //! Output a message to the logger
  490. //! \param szWarn Message
  491. void LogInfo(const char *szWarn);
  492. // -------------------------------------------------------------------
  493. //! Output an error to the logger
  494. //! \param szWarn Error message
  495. AI_WONT_RETURN void LogError(const char *szWarn) AI_WONT_RETURN_SUFFIX;
  496. // -------------------------------------------------------------------
  497. //! Parse a string, enclosed in double quotation marks
  498. //! \param out Output string
  499. //! \param szName Name of the enclosing element -> used in error
  500. //! messages.
  501. //! \return false if an error occurred
  502. bool ParseString(std::string &out, const char *szName);
  503. public:
  504. const char *mFilePtr; ////< Pointer to current data
  505. const char *mEnd; ///< The end pointer of the file data
  506. //! background color to be passed to the viewer
  507. //! QNAN if none was found
  508. aiColor3D m_clrBackground;
  509. //! Base ambient color to be passed to all materials
  510. //! QNAN if none was found
  511. aiColor3D m_clrAmbient;
  512. //! List of all materials found in the file
  513. std::vector<Material> m_vMaterials;
  514. //! List of all meshes found in the file
  515. std::vector<Mesh> m_vMeshes;
  516. //! List of all dummies found in the file
  517. std::vector<Dummy> m_vDummies;
  518. //! List of all lights found in the file
  519. std::vector<Light> m_vLights;
  520. //! List of all cameras found in the file
  521. std::vector<Camera> m_vCameras;
  522. //! Current line in the file
  523. unsigned int iLineNumber;
  524. //! First frame
  525. unsigned int iFirstFrame;
  526. //! Last frame
  527. unsigned int iLastFrame;
  528. //! Frame speed - frames per second
  529. unsigned int iFrameSpeed;
  530. //! Ticks per frame
  531. unsigned int iTicksPerFrame;
  532. //! true if the last character read was an end-line character
  533. bool bLastWasEndLine;
  534. //! File format version
  535. unsigned int iFileFormat;
  536. };
  537. } // Namespace ASE
  538. } // namespace Assimp
  539. #endif // ASSIMP_BUILD_NO_3DS_IMPORTER
  540. #endif // !! include guard