MCPcopy Create free account
hub / github.com/assimp/assimp / ParseFile

Method ParseFile

code/AssetLib/SMD/SMDLoader.cpp:632–673  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Parse the file

Source from the content-addressed store, hash-verified

630// ------------------------------------------------------------------------------------------------
631// Parse the file
632void 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
675void SMDImporter::ReadSmd(const std::string &pFile, IOSystem* pIOHandler) {
676 std::unique_ptr<IOStream> file(pIOHandler->Open(pFile, "rb"));

Callers

nothing calls this directly

Calls 5

TokenMatchFunction · 0.85
strtoul10Function · 0.85
SkipSpacesAndLineEndFunction · 0.70
SkipLineFunction · 0.70
SkipSpacesFunction · 0.50

Tested by

no test coverage detected