MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / readAMCData

Method readAMCData

physx/samples/samplebase/AcclaimLoader.cpp:630–682  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

628
629///////////////////////////////////////////////////////////////////////////////
630bool Acclaim::readAMCData(const char* filename, Acclaim::ASFData& asfData, Acclaim::AMCData& amcData)
631{
632 using namespace Acclaim;
633
634 char token[MAX_TOKEN_LENGTH];
635
636 SampleArray<FrameData> tempFrameData;
637 tempFrameData.reserve(300);
638
639 SampleFramework::File* fp = NULL;
640 PxToolkit::fopen_s(&fp, filename, "r");
641
642 if (!fp)
643 return false;
644
645 SampleFileBuffer buffer(fp);
646
647 while (buffer.getNextToken(token, false) == true)
648 {
649 if (token[0] == '#') // comment
650 {
651 buffer.skipUntilNextLine();
652 continue;
653 }
654 else if (token[0] == ':') // blocks
655 {
656 const char* str = token + 1; // remainder of the string
657
658 if (strcmp(str, "FULLY-SPECIFIED") == 0)
659 continue;
660 else if (strcmp(str, "DEGREES") == 0)
661 continue;
662 }
663 else if (isNumeric(token[0]) == true)
664 {
665 // frame number
666 //int frameNo = atoi(token);
667
668 FrameData frameData;
669 if (readFrameData(buffer, asfData, frameData) == true)
670 tempFrameData.pushBack(frameData);
671 }
672 }
673
674 amcData.mNbFrames = tempFrameData.size();
675
676 amcData.mFrameData = (FrameData*)malloc(sizeof(FrameData) * amcData.mNbFrames);
677 memcpy(amcData.mFrameData, tempFrameData.begin(), sizeof(FrameData) * amcData.mNbFrames);
678
679 fclose(fp);
680
681 return true;
682}
683

Callers

nothing calls this directly

Calls 11

strcmpFunction · 0.85
isNumericFunction · 0.85
readFrameDataFunction · 0.85
getNextTokenMethod · 0.80
skipUntilNextLineMethod · 0.80
fopen_sFunction · 0.50
mallocFunction · 0.50
reserveMethod · 0.45
pushBackMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected