ASEParser.h 23 KB

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