------------------------------------------------------------------------------------------------ Parse the file
| 630 | // ------------------------------------------------------------------------------------------------ |
| 631 | // Parse the file |
| 632 | void SMDImporter::ParseFile() { |
| 633 | const char* szCurrent = &mBuffer[0]; |
| 634 | |
| 635 | // read line per line ... |
| 636 | for ( ;; ) { |
| 637 | if(!SkipSpacesAndLineEnd(szCurrent,&szCurrent, mEnd)) { |
| 638 | break; |
| 639 | } |
| 640 | |
| 641 | // "version <n> \n", <n> should be 1 for hl and hl2 SMD files |
| 642 | if (TokenMatch(szCurrent,"version",7)) { |
| 643 | if(!SkipSpaces(szCurrent,&szCurrent, mEnd)) break; |
| 644 | if (1 != strtoul10(szCurrent,&szCurrent)) { |
| 645 | ASSIMP_LOG_WARN("SMD.version is not 1. This " |
| 646 | "file format is not known. Continuing happily ..."); |
| 647 | } |
| 648 | continue; |
| 649 | } |
| 650 | // "nodes\n" - Starts the node section |
| 651 | if (TokenMatch(szCurrent,"nodes",5)) { |
| 652 | ParseNodesSection(szCurrent, &szCurrent, mEnd); |
| 653 | continue; |
| 654 | } |
| 655 | // "triangles\n" - Starts the triangle section |
| 656 | if (TokenMatch(szCurrent,"triangles",9)) { |
| 657 | ParseTrianglesSection(szCurrent, &szCurrent, mEnd); |
| 658 | continue; |
| 659 | } |
| 660 | // "vertexanimation\n" - Starts the vertex animation section |
| 661 | if (TokenMatch(szCurrent,"vertexanimation",15)) { |
| 662 | bHasUVs = false; |
| 663 | ParseVASection(szCurrent, &szCurrent, mEnd); |
| 664 | continue; |
| 665 | } |
| 666 | // "skeleton\n" - Starts the skeleton section |
| 667 | if (TokenMatch(szCurrent,"skeleton",8)) { |
| 668 | ParseSkeletonSection(szCurrent, &szCurrent, mEnd); |
| 669 | continue; |
| 670 | } |
| 671 | SkipLine(szCurrent, &szCurrent, mEnd); |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | void SMDImporter::ReadSmd(const std::string &pFile, IOSystem* pIOHandler) { |
| 676 | std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb")); |
nothing calls this directly
no test coverage detected