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

Method ParseVASection

code/AssetLib/SMD/SMDLoader.cpp:763–802  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Parse the vertex animation section of the file

Source from the content-addressed store, hash-verified

761// ------------------------------------------------------------------------------------------------
762// Parse the vertex animation section of the file
763void SMDImporter::ParseVASection(const char *szCurrent, const char **szCurrentOut, const char *end) {
764 unsigned int iCurIndex = 0;
765 for ( ;; ) {
766 if (!SkipSpacesAndLineEnd(szCurrent,&szCurrent, end)) {
767 break;
768 }
769
770 // "end\n" - Ends the "vertexanimation" section
771 if (TokenMatch(szCurrent,"end",3)) {
772 break;
773 }
774
775 // "time <n>\n"
776 if (TokenMatch(szCurrent,"time",4)) {
777 // NOTE: The doc says that time values COULD be negative ...
778 // NOTE2: this is the shape key -> valve docs
779 int iTime = 0;
780 if (!ParseSignedInt(szCurrent, &szCurrent, end, iTime) || configFrameID != (unsigned int)iTime) {
781 break;
782 }
783 SkipLine(szCurrent,&szCurrent, end);
784 } else {
785 if(0 == iCurIndex) {
786 asTriangles.emplace_back();
787 }
788 if (++iCurIndex == 3) {
789 iCurIndex = 0;
790 }
791 ParseVertex(szCurrent,&szCurrent, end, asTriangles.back().avVertices[iCurIndex],true);
792 }
793 }
794
795 if (iCurIndex != 2 && !asTriangles.empty()) {
796 // we want to no degenerates, so throw this triangle away
797 asTriangles.pop_back();
798 }
799
800 SkipSpacesAndLineEnd(szCurrent,&szCurrent, end);
801 *szCurrentOut = szCurrent;
802}
803
804// ------------------------------------------------------------------------------------------------
805// Parse the skeleton section of the file

Callers

nothing calls this directly

Calls 6

TokenMatchFunction · 0.85
ParseSignedIntFunction · 0.85
emplace_backMethod · 0.80
SkipSpacesAndLineEndFunction · 0.70
SkipLineFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected