MD5Parser.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (assimp)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2025, 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. // print the command line options to the console
  100. char *sz = buffer;
  101. while (buffer < bufferEnd) {
  102. if (IsLineEnd(*buffer++)) {
  103. break;
  104. }
  105. }
  106. if (buffer == bufferEnd) {
  107. return;
  108. }
  109. ASSIMP_LOG_INFO(std::string(sz, std::min((uintptr_t)MAX_LOG_MESSAGE_LENGTH, (uintptr_t)(buffer - sz))));
  110. SkipSpacesAndLineEnd();
  111. }
  112. // ------------------------------------------------------------------------------------------------
  113. // Recursive MD5 parsing function
  114. bool MD5Parser::ParseSection(Section &out) {
  115. // store the current line number for use in error messages
  116. out.iLineNumber = lineNumber;
  117. // first parse the name of the section
  118. char *sz = buffer;
  119. while (!IsSpaceOrNewLine(*buffer)) {
  120. ++buffer;
  121. if (buffer == bufferEnd) {
  122. return false;
  123. }
  124. }
  125. out.mName = std::string(sz, (uintptr_t)(buffer - sz));
  126. while (IsSpace(*buffer)) {
  127. ++buffer;
  128. if (buffer == bufferEnd) {
  129. return false;
  130. }
  131. }
  132. bool running = true;
  133. while (running) {
  134. if ('{' == *buffer) {
  135. // it is a normal section so read all lines
  136. ++buffer;
  137. if (buffer == bufferEnd) {
  138. return false;
  139. }
  140. bool run = true;
  141. while (run) {
  142. while (IsSpaceOrNewLine(*buffer)) {
  143. ++buffer;
  144. if (buffer == bufferEnd) {
  145. return false;
  146. }
  147. }
  148. if ('\0' == *buffer) {
  149. return false; // seems this was the last section
  150. }
  151. if ('}' == *buffer) {
  152. ++buffer;
  153. break;
  154. }
  155. out.mElements.emplace_back();
  156. Element &elem = out.mElements.back();
  157. elem.iLineNumber = lineNumber;
  158. elem.szStart = buffer;
  159. elem.end = bufferEnd;
  160. // terminate the line with zero
  161. while (!IsLineEnd(*buffer)) {
  162. ++buffer;
  163. if (buffer == bufferEnd) {
  164. return false;
  165. }
  166. }
  167. if (*buffer) {
  168. ++lineNumber;
  169. *buffer++ = '\0';
  170. if (buffer == bufferEnd) {
  171. return false;
  172. }
  173. }
  174. }
  175. break;
  176. } else if (!IsSpaceOrNewLine(*buffer)) {
  177. // it is an element at global scope. Parse its value and go on
  178. sz = buffer;
  179. while (!IsSpaceOrNewLine(*buffer++)) {
  180. if (buffer == bufferEnd) {
  181. return false;
  182. }
  183. }
  184. out.mGlobalValue = std::string(sz, (uintptr_t)(buffer - sz));
  185. continue;
  186. }
  187. break;
  188. }
  189. if (buffer == bufferEnd) {
  190. return false;
  191. }
  192. while (IsSpaceOrNewLine(*buffer)) {
  193. if (buffer == bufferEnd) {
  194. break;
  195. }
  196. ++buffer;
  197. }
  198. return '\0' != *buffer;
  199. }
  200. // skip all spaces ... handle EOL correctly
  201. inline void AI_MD5_SKIP_SPACES(const char **sz, const char *bufferEnd, int linenumber) {
  202. if (!SkipSpaces(sz, bufferEnd)) {
  203. MD5Parser::ReportWarning("Unexpected end of line", linenumber);
  204. }
  205. }
  206. // read a triple float in brackets: (1.0 1.0 1.0)
  207. inline void AI_MD5_READ_TRIPLE(aiVector3D &vec, const char **sz, const char *bufferEnd, int linenumber) {
  208. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  209. if ('(' != **sz) {
  210. MD5Parser::ReportWarning("Unexpected token: ( was expected", linenumber);
  211. if (*sz == bufferEnd)
  212. return;
  213. ++*sz;
  214. }
  215. if (*sz == bufferEnd)
  216. return;
  217. ++*sz;
  218. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  219. *sz = fast_atoreal_move<float>(*sz, (float &)vec.x);
  220. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  221. *sz = fast_atoreal_move<float>(*sz, (float &)vec.y);
  222. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  223. *sz = fast_atoreal_move<float>(*sz, (float &)vec.z);
  224. AI_MD5_SKIP_SPACES(sz, bufferEnd, linenumber);
  225. if (')' != **sz) {
  226. MD5Parser::ReportWarning("Unexpected token: ) was expected", linenumber);
  227. }
  228. if (*sz == bufferEnd)
  229. return;
  230. ++*sz;
  231. }
  232. // parse a string, enclosed in quotation marks or not
  233. inline bool AI_MD5_PARSE_STRING(const char **sz, const char *bufferEnd, aiString &out, int linenumber) {
  234. bool bQuota = (**sz == '\"');
  235. const char *szStart = *sz;
  236. while (!IsSpaceOrNewLine(**sz)) {
  237. ++*sz;
  238. if (*sz == bufferEnd) break;
  239. }
  240. const char *szEnd = *sz;
  241. if (bQuota) {
  242. szStart++;
  243. if ('\"' != *(szEnd -= 1)) {
  244. MD5Parser::ReportWarning("Expected closing quotation marks in string", linenumber);
  245. ++*sz;
  246. }
  247. }
  248. out.length = (ai_uint32)(szEnd - szStart);
  249. ::memcpy(out.data, szStart, out.length);
  250. out.data[out.length] = '\0';
  251. return true;
  252. }
  253. // parse a string, enclosed in quotation marks
  254. inline void AI_MD5_PARSE_STRING_IN_QUOTATION(const char **sz, const char *bufferEnd, aiString &out) {
  255. out.length = 0u;
  256. while (('\"' != **sz && '\0' != **sz) && *sz != bufferEnd) {
  257. ++*sz;
  258. }
  259. if ('\0' != **sz) {
  260. const char *szStart = ++(*sz);
  261. while (('\"' != **sz && '\0' != **sz) && *sz != bufferEnd) {
  262. ++*sz;
  263. }
  264. if ('\0' != **sz) {
  265. const char *szEnd = *sz;
  266. ++*sz;
  267. out.length = (ai_uint32)(szEnd - szStart);
  268. ::memcpy(out.data, szStart, out.length);
  269. }
  270. }
  271. out.data[out.length] = '\0';
  272. }
  273. // ------------------------------------------------------------------------------------------------
  274. // .MD5MESH parsing function
  275. MD5MeshParser::MD5MeshParser(SectionArray &mSections) {
  276. ASSIMP_LOG_DEBUG("MD5MeshParser begin");
  277. // now parse all sections
  278. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  279. if ((*iter).mName == "numMeshes") {
  280. mMeshes.reserve(::strtoul10((*iter).mGlobalValue.c_str()));
  281. } else if ((*iter).mName == "numJoints") {
  282. mJoints.reserve(::strtoul10((*iter).mGlobalValue.c_str()));
  283. } else if ((*iter).mName == "joints") {
  284. // "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 )
  285. for (const auto &elem : (*iter).mElements) {
  286. mJoints.emplace_back();
  287. BoneDesc &desc = mJoints.back();
  288. const char *sz = elem.szStart;
  289. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mName);
  290. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  291. // negative values, at least -1, is allowed here
  292. desc.mParentIndex = (int)strtol10(sz, &sz);
  293. AI_MD5_READ_TRIPLE(desc.mPositionXYZ, &sz, elem.end, elem.iLineNumber);
  294. AI_MD5_READ_TRIPLE(desc.mRotationQuat, &sz, elem.end, elem.iLineNumber); // normalized quaternion, so w is not there
  295. }
  296. } else if ((*iter).mName == "mesh") {
  297. mMeshes.emplace_back();
  298. MeshDesc &desc = mMeshes.back();
  299. for (const auto &elem : (*iter).mElements) {
  300. const char *sz = elem.szStart;
  301. // shader attribute
  302. if (TokenMatch(sz, "shader", 6)) {
  303. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  304. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mShader);
  305. }
  306. // numverts attribute
  307. else if (TokenMatch(sz, "numverts", 8)) {
  308. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  309. desc.mVertices.resize(strtoul10(sz));
  310. }
  311. // numtris attribute
  312. else if (TokenMatch(sz, "numtris", 7)) {
  313. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  314. desc.mFaces.resize(strtoul10(sz));
  315. }
  316. // numweights attribute
  317. else if (TokenMatch(sz, "numweights", 10)) {
  318. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  319. desc.mWeights.resize(strtoul10(sz));
  320. }
  321. // vert attribute
  322. // "vert 0 ( 0.394531 0.513672 ) 0 1"
  323. else if (TokenMatch(sz, "vert", 4)) {
  324. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  325. const unsigned int idx = ::strtoul10(sz, &sz);
  326. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  327. if (idx >= desc.mVertices.size())
  328. desc.mVertices.resize(idx + 1);
  329. VertexDesc &vert = desc.mVertices[idx];
  330. if ('(' != *sz++)
  331. MD5Parser::ReportWarning("Unexpected token: ( was expected", elem.iLineNumber);
  332. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  333. sz = fast_atoreal_move<float>(sz, (float &)vert.mUV.x);
  334. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  335. sz = fast_atoreal_move<float>(sz, (float &)vert.mUV.y);
  336. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  337. if (')' != *sz++)
  338. MD5Parser::ReportWarning("Unexpected token: ) was expected", elem.iLineNumber);
  339. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  340. vert.mFirstWeight = ::strtoul10(sz, &sz);
  341. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  342. vert.mNumWeights = ::strtoul10(sz, &sz);
  343. }
  344. // tri attribute
  345. // "tri 0 15 13 12"
  346. else if (TokenMatch(sz, "tri", 3)) {
  347. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  348. const unsigned int idx = strtoul10(sz, &sz);
  349. if (idx >= desc.mFaces.size())
  350. desc.mFaces.resize(idx + 1);
  351. aiFace &face = desc.mFaces[idx];
  352. face.mIndices = new unsigned int[face.mNumIndices = 3];
  353. for (unsigned int i = 0; i < 3; ++i) {
  354. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  355. face.mIndices[i] = strtoul10(sz, &sz);
  356. }
  357. }
  358. // weight attribute
  359. // "weight 362 5 0.500000 ( -3.553583 11.893474 9.719339 )"
  360. else if (TokenMatch(sz, "weight", 6)) {
  361. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  362. const unsigned int idx = strtoul10(sz, &sz);
  363. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  364. if (idx >= desc.mWeights.size())
  365. desc.mWeights.resize(idx + 1);
  366. WeightDesc &weight = desc.mWeights[idx];
  367. weight.mBone = strtoul10(sz, &sz);
  368. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  369. sz = fast_atoreal_move<float>(sz, weight.mWeight);
  370. AI_MD5_READ_TRIPLE(weight.vOffsetPosition, &sz, elem.end, elem.iLineNumber);
  371. }
  372. }
  373. }
  374. }
  375. ASSIMP_LOG_DEBUG("MD5MeshParser end");
  376. }
  377. // ------------------------------------------------------------------------------------------------
  378. // .MD5ANIM parsing function
  379. MD5AnimParser::MD5AnimParser(SectionArray &mSections) {
  380. ASSIMP_LOG_DEBUG("MD5AnimParser begin");
  381. fFrameRate = 24.0f;
  382. mNumAnimatedComponents = UINT_MAX;
  383. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  384. if ((*iter).mName == "hierarchy") {
  385. // "sheath" 0 63 6
  386. for (const auto &elem : (*iter).mElements) {
  387. mAnimatedBones.emplace_back();
  388. AnimBoneDesc &desc = mAnimatedBones.back();
  389. const char *sz = elem.szStart;
  390. AI_MD5_PARSE_STRING_IN_QUOTATION(&sz, elem.end, desc.mName);
  391. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  392. // parent index - negative values are allowed (at least -1)
  393. desc.mParentIndex = ::strtol10(sz, &sz);
  394. // flags (highest is 2^6-1)
  395. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  396. if (63 < (desc.iFlags = ::strtoul10(sz, &sz))) {
  397. MD5Parser::ReportWarning("Invalid flag combination in hierarchy section", elem.iLineNumber);
  398. }
  399. AI_MD5_SKIP_SPACES(& sz, elem.end, elem.iLineNumber);
  400. // index of the first animation keyframe component for this joint
  401. desc.iFirstKeyIndex = ::strtoul10(sz, &sz);
  402. }
  403. } else if ((*iter).mName == "baseframe") {
  404. // ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000242 0.707107 )
  405. for (const auto &elem : (*iter).mElements) {
  406. const char *sz = elem.szStart;
  407. mBaseFrames.emplace_back();
  408. BaseFrameDesc &desc = mBaseFrames.back();
  409. AI_MD5_READ_TRIPLE(desc.vPositionXYZ, &sz, elem.end, elem.iLineNumber);
  410. AI_MD5_READ_TRIPLE(desc.vRotationQuat, &sz, elem.end, elem.iLineNumber);
  411. }
  412. } else if ((*iter).mName == "frame") {
  413. if (!(*iter).mGlobalValue.length()) {
  414. MD5Parser::ReportWarning("A frame section must have a frame index", (*iter).iLineNumber);
  415. continue;
  416. }
  417. mFrames.emplace_back();
  418. FrameDesc &desc = mFrames.back();
  419. desc.iIndex = strtoul10((*iter).mGlobalValue.c_str());
  420. // we do already know how much storage we will presumably need
  421. if (UINT_MAX != mNumAnimatedComponents) {
  422. desc.mValues.reserve(mNumAnimatedComponents);
  423. }
  424. // now read all elements (continuous list of floats)
  425. for (const auto &elem : (*iter).mElements) {
  426. const char *sz = elem.szStart;
  427. while (SkipSpacesAndLineEnd(&sz, elem.end)) {
  428. float f;
  429. sz = fast_atoreal_move<float>(sz, f);
  430. desc.mValues.push_back(f);
  431. }
  432. }
  433. } else if ((*iter).mName == "numFrames") {
  434. mFrames.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  435. } else if ((*iter).mName == "numJoints") {
  436. const unsigned int num = strtoul10((*iter).mGlobalValue.c_str());
  437. mAnimatedBones.reserve(num);
  438. // try to guess the number of animated components if that element is not given
  439. if (UINT_MAX == mNumAnimatedComponents) {
  440. mNumAnimatedComponents = num * 6;
  441. }
  442. } else if ((*iter).mName == "numAnimatedComponents") {
  443. mAnimatedBones.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  444. } else if ((*iter).mName == "frameRate") {
  445. fast_atoreal_move<float>((*iter).mGlobalValue.c_str(), fFrameRate);
  446. }
  447. }
  448. ASSIMP_LOG_DEBUG("MD5AnimParser end");
  449. }
  450. // ------------------------------------------------------------------------------------------------
  451. // .MD5CAMERA parsing function
  452. MD5CameraParser::MD5CameraParser(SectionArray &mSections) {
  453. ASSIMP_LOG_DEBUG("MD5CameraParser begin");
  454. fFrameRate = 24.0f;
  455. for (SectionArray::const_iterator iter = mSections.begin(), iterEnd = mSections.end(); iter != iterEnd; ++iter) {
  456. if ((*iter).mName == "numFrames") {
  457. frames.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  458. } else if ((*iter).mName == "frameRate") {
  459. fFrameRate = fast_atof((*iter).mGlobalValue.c_str());
  460. } else if ((*iter).mName == "numCuts") {
  461. cuts.reserve(strtoul10((*iter).mGlobalValue.c_str()));
  462. } else if ((*iter).mName == "cuts") {
  463. for (const auto &elem : (*iter).mElements) {
  464. cuts.push_back(strtoul10(elem.szStart) + 1);
  465. }
  466. } else if ((*iter).mName == "camera") {
  467. for (const auto &elem : (*iter).mElements) {
  468. const char *sz = elem.szStart;
  469. frames.emplace_back();
  470. CameraAnimFrameDesc &cur = frames.back();
  471. AI_MD5_READ_TRIPLE(cur.vPositionXYZ, &sz, elem.end, elem.iLineNumber);
  472. AI_MD5_READ_TRIPLE(cur.vRotationQuat, &sz, elem.end, elem.iLineNumber);
  473. AI_MD5_SKIP_SPACES(&sz, elem.end, elem.iLineNumber);
  474. cur.fFOV = fast_atof(sz);
  475. }
  476. }
  477. }
  478. ASSIMP_LOG_DEBUG("MD5CameraParser end");
  479. }