MD5Parser.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2024, assimp team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the assimp team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the assimp team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /** @file MD5Parser.cpp
  35. * @brief Implementation of the MD5 parser class
  36. */
  37. // internal headers
  38. #include "AssetLib/MD5/MD5Loader.h"
  39. #include "Material/MaterialSystem.h"
  40. #include <assimp/ParsingUtils.h>
  41. #include <assimp/StringComparison.h>
  42. #include <assimp/fast_atof.h>
  43. #include <assimp/mesh.h>
  44. #include <assimp/DefaultLogger.hpp>
  45. using namespace Assimp;
  46. using namespace Assimp::MD5;
  47. // ------------------------------------------------------------------------------------------------
  48. // Parse the segment structure for an MD5 file
  49. MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), bufferEnd(nullptr), fileSize(_fileSize), lineNumber(0) {
  50. ai_assert(nullptr != _buffer);
  51. ai_assert(0 != _fileSize);
  52. bufferEnd = buffer + fileSize;
  53. ASSIMP_LOG_DEBUG("MD5Parser begin");
  54. // parse the file header
  55. ParseHeader();
  56. // and read all sections until we're finished
  57. bool running = true;
  58. while (running) {
  59. mSections.emplace_back();
  60. Section &sec = mSections.back();
  61. if (!ParseSection(sec)) {
  62. break;
  63. }
  64. }
  65. if (!DefaultLogger::isNullLogger()) {
  66. char szBuffer[128]; // should be sufficiently large
  67. ::ai_snprintf(szBuffer, 128, "MD5Parser end. Parsed %i sections", (int)mSections.size());
  68. ASSIMP_LOG_DEBUG(szBuffer);
  69. }
  70. }
  71. // ------------------------------------------------------------------------------------------------
  72. // Report error to the log stream
  73. AI_WONT_RETURN void MD5Parser::ReportError(const char *error, unsigned int line) {
  74. char szBuffer[1024];
  75. ::ai_snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, error);
  76. throw DeadlyImportError(szBuffer);
  77. }
  78. // ------------------------------------------------------------------------------------------------
  79. // Report warning to the log stream
  80. void MD5Parser::ReportWarning(const char *warn, unsigned int line) {
  81. char szBuffer[1024];
  82. ::snprintf(szBuffer, sizeof(szBuffer), "[MD5] Line %u: %s", line, warn);
  83. ASSIMP_LOG_WARN(szBuffer);
  84. }
  85. // ------------------------------------------------------------------------------------------------
  86. // Parse and validate the MD5 header
  87. void MD5Parser::ParseHeader() {
  88. // parse and validate the file version
  89. SkipSpaces();
  90. if (!TokenMatch(buffer, "MD5Version", 10)) {
  91. ReportError("Invalid MD5 file: MD5Version tag has not been found");
  92. }
  93. SkipSpaces();
  94. unsigned int iVer = ::strtoul10(buffer, (const char **)&buffer);
  95. if (10 != iVer) {
  96. ReportError("MD5 version tag is unknown (10 is expected)");
  97. }
  98. SkipLine();
  99. if (buffer == bufferEnd) {
  100. return;
  101. }
  102. // print the command line options to the console
  103. // FIX: can break the log length limit, so we need to be careful
  104. char *sz = buffer;
  105. while (!IsLineEnd(*buffer++));
  106. ASSIMP_LOG_INFO(std::string(sz, std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer - sz))));
  107. SkipSpacesAndLineEnd();
  108. }
  109. // ------------------------------------------------------------------------------------------------
  110. // Recursive MD5 parsing function
  111. bool MD5Parser::ParseSection(Section &out) {
  112. // store the current line number for use in error messages
  113. out.iLineNumber = lineNumber;
  114. // first parse the name of the section
  115. char *sz = buffer;
  116. while (!IsSpaceOrNewLine(*buffer)) {
  117. ++buffer;
  118. if (buffer == bufferEnd) {
  119. return false;
  120. }
  121. }
  122. out.mName = std::string(sz, (uintptr_t)(buffer - sz));
  123. while (IsSpace(*buffer)) {
  124. ++buffer;
  125. if (buffer == bufferEnd) {
  126. return false;
  127. }
  128. }
  129. bool running = true;
  130. while (running) {
  131. if ('{' == *buffer) {
  132. // it is a normal section so read all lines
  133. ++buffer;
  134. if (buffer == bufferEnd) {
  135. return false;
  136. }
  137. bool run = true;
  138. while (run) {
  139. while (IsSpaceOrNewLine(*buffer)) {
  140. ++buffer;
  141. if (buffer == bufferEnd) {
  142. return false;
  143. }
  144. }
  145. if ('\0' == *buffer) {
  146. return false; // seems this was the last section
  147. }
  148. if ('}' == *buffer) {
  149. ++buffer;
  150. break;
  151. }
  152. out.mElements.emplace_back();
  153. Element &elem = out.mElements.back();
  154. elem.iLineNumber = lineNumber;
  155. elem.szStart = buffer;
  156. elem.end = bufferEnd;
  157. // terminate the line with zero
  158. while (!IsLineEnd(*buffer)) {
  159. ++buffer;
  160. if (buffer == bufferEnd) {
  161. return false;
  162. }
  163. }
  164. if (*buffer) {
  165. ++lineNumber;
  166. *buffer++ = '\0';
  167. if (buffer == bufferEnd) {
  168. return false;
  169. }
  170. }
  171. }
  172. break;
  173. } else if (!IsSpaceOrNewLine(*buffer)) {
  174. // it is an element at global scope. Parse its value and go on
  175. sz = buffer;
  176. while (!IsSpaceOrNewLine(*buffer++)) {
  177. if (buffer == bufferEnd) {
  178. return false;
  179. }
  180. }
  181. out.mGlobalValue = std::string(sz, (uintptr_t)(buffer - sz));
  182. continue;
  183. }
  184. break;
  185. }
  186. if (buffer == bufferEnd) {
  187. return false;
  188. }
  189. while (IsSpaceOrNewLine(*buffer)) {
  190. if (buffer == bufferEnd) {
  191. break;
  192. }
  193. ++buffer;
  194. }
  195. return '\0' != *buffer;
  196. }
  197. // skip all spaces ... handle EOL correctly
  198. inline void AI_MD5_SKIP_SPACES(const char **sz, const char *bufferEnd, int linenumber) {
  199. if (!SkipSpaces(sz, bufferEnd)) {
  200. MD5Parser::ReportWarning("Unexpected end of line", linenumber);
  201. }
  202. }
  203. // read a triple float in brackets: (1.0 1.0 1.0)
  204. inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *bufferEnd, int linenumber) {
  205. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  206. if ('(' != **sz) {
  207. MD5Parser::ReportWarning("Unexpected token: ( was expected", linenumber);
  208. ++*sz;
  209. }
  210. ++*sz;
  211. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  212. *sz = fast_atoreal_move<float>(*sz, (float &)vec.x);
  213. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  214. *sz = fast_atoreal_move<float>(*sz, (float &)vec.y);
  215. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  216. *sz = fast_atoreal_move<float>(*sz, (float &)vec.z);
  217. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  218. if (')' != **sz) {
  219. MD5Parser::ReportWarning("Unexpected token: ) was expected", linenumber);
  220. }
  221. ++*sz;
  222. }
  223. // parse a string, enclosed in quotation marks or not
  224. inline bool AI_MD5_PARSE_STRING(const char **sz, const char *bufferEnd, aiString &out, int linenumber) {
  225. bool bQuota = (**sz == '\"');
  226. const char *szStart = *sz;
  227. while (!IsSpaceOrNewLine(**sz)) {
  228. ++*sz;
  229. if (*sz == bufferEnd) break;
  230. }
  231. const char *szEnd = *sz;
  232. if (bQuota) {
  233. szStart++;
  234. if ('\"' != *(szEnd -= 1)) {
  235. MD5Parser::ReportWarning("Expected closing quotation marks in string", linenumber);
  236. ++*sz;
  237. }
  238. }
  239. out.length = (ai_uint32)(szEnd - szStart);
  240. ::memcpy(out.data, szStart, out.length);
  241. out.data[out.length] = '\0';
  242. return true;
  243. }
  244. // parse a string, enclosed in quotation marks
  245. inline void AI_MD5_PARSE_STRING_IN_QUOTATION(const char **sz, const char *bufferEnd, aiString &out) {
  246. out.length = 0u;
  247. while (('\"' != **sz && '\0' != **sz) && *sz != bufferEnd) {
  248. ++*sz;
  249. }
  250. if ('\0' != **sz) {
  251. const char *szStart = ++(*sz);
  252. while (('\"' != **sz && '\0' != **sz) && *sz != bufferEnd) {
  253. ++*sz;
  254. }
  255. if ('\0' != **sz) {
  256. const char *szEnd = *sz;
  257. ++*sz;
  258. out.length = (ai_uint32)(szEnd - szStart);
  259. ::memcpy(out.data, szStart, out.length);
  260. }
  261. }
  262. out.data[out.length] = '\0';
  263. }
  264. // ------------------------------------------------------------------------------------------------
  265. // .MD5MESH parsing function
  266. MD5MeshParser::MD5MeshParser(SectionArray &mSections) {
  267. ASSIMP_LOG_DEBUG("MD5MeshParser begin");
  268. // now parse all sections
  269. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  270. if ((*iter).mName == "numMeshes") {
  271. mMeshes.reserve(::strtoul10((*iter).mGlobalValue.c_str()));
  272. } else if ((*iter).mName == "numJoints") {
  273. mJoints.reserve(::strtoul10((*iter).mGlobalValue.c_str()));
  274. } else if ((*iter).mName == "joints") {
  275. // "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 )
  276. for (const auto &elem : (*iter).mElements) {
  277. mJoints.emplace_back();
  278. BoneDesc &desc = mJoints.back();
  279. const char *sz = elem.szStart;
  280. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mName);
  281. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  282. // negative values, at least -1, is allowed here
  283. desc.mParentIndex = (int)strtol10(sz, &sz);
  284. AI_MD5_READ_TRIPLE(desc.mPositionXYZ, &sz, elem.end, elem.iLineNumber);
  285. AI_MD5_READ_TRIPLE(desc.mRotationQuat, &sz, elem.end, elem.iLineNumber); // normalized quaternion, so w is not there
  286. }
  287. } else if ((*iter).mName == "mesh") {
  288. mMeshes.emplace_back();
  289. MeshDesc &desc = mMeshes.back();
  290. for (const auto &elem : (*iter).mElements) {
  291. const char *sz = elem.szStart;
  292. // shader attribute
  293. if (TokenMatch(sz, "shader", 6)) {
  294. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  295. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mShader);
  296. }
  297. // numverts attribute
  298. else if (TokenMatch(sz, "numverts", 8)) {
  299. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  300. desc.mVertices.resize(strtoul10(sz));
  301. }
  302. // numtris attribute
  303. else if (TokenMatch(sz, "numtris", 7)) {
  304. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  305. desc.mFaces.resize(strtoul10(sz));
  306. }
  307. // numweights attribute
  308. else if (TokenMatch(sz, "numweights", 10)) {
  309. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  310. desc.mWeights.resize(strtoul10(sz));
  311. }
  312. // vert attribute
  313. // "vert 0 ( 0.394531 0.513672 ) 0 1"
  314. else if (TokenMatch(sz, "vert", 4)) {
  315. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  316. const unsigned int idx = ::strtoul10(sz, &sz);
  317. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  318. if (idx >= desc.mVertices.size())
  319. desc.mVertices.resize(idx + 1);
  320. VertexDesc &vert = desc.mVertices[idx];
  321. if ('(' != *sz++)
  322. MD5Parser::ReportWarning("Unexpected token: ( was expected", elem.iLineNumber);
  323. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  324. sz = fast_atoreal_move<float>(sz, (float &)vert.mUV.x);
  325. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  326. sz = fast_atoreal_move<float>(sz, (float &)vert.mUV.y);
  327. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  328. if (')' != *sz++)
  329. MD5Parser::ReportWarning("Unexpected token: ) was expected", elem.iLineNumber);
  330. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  331. vert.mFirstWeight = ::strtoul10(sz, &sz);
  332. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  333. vert.mNumWeights = ::strtoul10(sz, &sz);
  334. }
  335. // tri attribute
  336. // "tri 0 15 13 12"
  337. else if (TokenMatch(sz, "tri", 3)) {
  338. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  339. const unsigned int idx = strtoul10(sz, &sz);
  340. if (idx >= desc.mFaces.size())
  341. desc.mFaces.resize(idx + 1);
  342. aiFace &face = desc.mFaces[idx];
  343. face.mIndices = new unsigned int[face.mNumIndices = 3];
  344. for (unsigned int i = 0; i < 3; ++i) {
  345. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  346. face.mIndices[i] = strtoul10(sz, &sz);
  347. }
  348. }
  349. // weight attribute
  350. // "weight 362 5 0.500000 ( -3.553583 11.893474 9.719339 )"
  351. else if (TokenMatch(sz, "weight", 6)) {
  352. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  353. const unsigned int idx = strtoul10(sz, &sz);
  354. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  355. if (idx >= desc.mWeights.size())
  356. desc.mWeights.resize(idx + 1);
  357. WeightDesc &weight = desc.mWeights[idx];
  358. weight.mBone = strtoul10(sz, &sz);
  359. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  360. sz = fast_atoreal_move<float>(sz, weight.mWeight);
  361. AI_MD5_READ_TRIPLE(weight.vOffsetPosition, &sz, elem.end, elem.iLineNumber);
  362. }
  363. }
  364. }
  365. }
  366. ASSIMP_LOG_DEBUG("MD5MeshParser end");
  367. }
  368. // ------------------------------------------------------------------------------------------------
  369. // .MD5ANIM parsing function
  370. MD5AnimParser::MD5AnimParser(SectionArray &mSections) {
  371. ASSIMP_LOG_DEBUG("MD5AnimParser begin");
  372. fFrameRate = 24.0f;
  373. mNumAnimatedComponents = UINT_MAX;
  374. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  375. if ((*iter).mName == "hierarchy") {
  376. // "sheath" 0 63 6
  377. for (const auto &elem : (*iter).mElements) {
  378. mAnimatedBones.emplace_back();
  379. AnimBoneDesc &desc = mAnimatedBones.back();
  380. const char *sz = elem.szStart;
  381. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mName);
  382. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  383. // parent index - negative values are allowed (at least -1)
  384. desc.mParentIndex = ::strtol10(sz, &sz);
  385. // flags (highest is 2^6-1)
  386. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  387. if (63 < (desc.iFlags = ::strtoul10(sz, &sz))) {
  388. MD5Parser::ReportWarning("Invalid flag combination in hierarchy section", elem.iLineNumber);
  389. }
  390. AI_MD5_SKIP_SPACES(& sz, elem.end, elem.iLineNumber);
  391. // index of the first animation keyframe component for this joint
  392. desc.iFirstKeyIndex = ::strtoul10(sz, &sz);
  393. }
  394. } else if ((*iter).mName == "baseframe") {
  395. // ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000242 0.707107 )
  396. for (const auto &elem : (*iter).mElements) {
  397. const char *sz = elem.szStart;
  398. mBaseFrames.emplace_back();
  399. BaseFrameDesc &desc = mBaseFrames.back();
  400. AI_MD5_READ_TRIPLE(desc.vPositionXYZ, &sz, elem.end, elem.iLineNumber);
  401. AI_MD5_READ_TRIPLE(desc.vRotationQuat, &sz, elem.end, elem.iLineNumber);
  402. }
  403. } else if ((*iter).mName == "frame") {
  404. if (!(*iter).mGlobalValue.length()) {
  405. MD5Parser::ReportWarning("A frame section must have a frame index", (*iter).iLineNumber);
  406. continue;
  407. }
  408. mFrames.emplace_back();
  409. FrameDesc &desc = mFrames.back();
  410. desc.iIndex = strtoul10((*iter).mGlobalValue.c_str());
  411. // we do already know how much storage we will presumably need
  412. if (UINT_MAX != mNumAnimatedComponents) {
  413. desc.mValues.reserve(mNumAnimatedComponents);
  414. }
  415. // now read all elements (continuous list of floats)
  416. for (const auto &elem : (*iter).mElements) {
  417. const char *sz = elem.szStart;
  418. while (SkipSpacesAndLineEnd(&sz, elem.end)) {
  419. float f;
  420. sz = fast_atoreal_move<float>(sz, f);
  421. desc.mValues.push_back(f);
  422. }
  423. }
  424. } else if ((*iter).mName == "numFrames") {
  425. mFrames.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  426. } else if ((*iter).mName == "numJoints") {
  427. const unsigned int num = strtoul10((*iter).mGlobalValue.c_str());
  428. mAnimatedBones.reserve(num);
  429. // try to guess the number of animated components if that element is not given
  430. if (UINT_MAX == mNumAnimatedComponents) {
  431. mNumAnimatedComponents = num * 6;
  432. }
  433. } else if ((*iter).mName == "numAnimatedComponents") {
  434. mAnimatedBones.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  435. } else if ((*iter).mName == "frameRate") {
  436. fast_atoreal_move<float>((*iter).mGlobalValue.c_str(), fFrameRate);
  437. }
  438. }
  439. ASSIMP_LOG_DEBUG("MD5AnimParser end");
  440. }
  441. // ------------------------------------------------------------------------------------------------
  442. // .MD5CAMERA parsing function
  443. MD5CameraParser::MD5CameraParser(SectionArray &mSections) {
  444. ASSIMP_LOG_DEBUG("MD5CameraParser begin");
  445. fFrameRate = 24.0f;
  446. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  447. if ((*iter).mName == "numFrames") {
  448. frames.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  449. } else if ((*iter).mName == "frameRate") {
  450. fFrameRate = fast_atof((*iter).mGlobalValue.c_str());
  451. } else if ((*iter).mName == "numCuts") {
  452. cuts.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  453. } else if ((*iter).mName == "cuts") {
  454. for (const auto &elem : (*iter).mElements) {
  455. cuts.push_back(strtoul10(elem.szStart) + 1);
  456. }
  457. } else if ((*iter).mName == "camera") {
  458. for (const auto &elem : (*iter).mElements) {
  459. const char *sz = elem.szStart;
  460. frames.emplace_back();
  461. CameraAnimFrameDesc &cur = frames.back();
  462. AI_MD5_READ_TRIPLE(cur.vPositionXYZ, &sz, elem.end, elem.iLineNumber);
  463. AI_MD5_READ_TRIPLE(cur.vRotationQuat, &sz, elem.end, elem.iLineNumber);
  464. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  465. cur.fFOV = fast_atof(sz);
  466. }
  467. }
  468. }
  469. ASSIMP_LOG_DEBUG("MD5CameraParser end");
  470. }