ASEParser.h 23 KB

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