ASEParser.h 23 KB

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