MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FullLoad

Method FullLoad

engine/Poseidon/World/Simulation/Animation/RtAnimation.cpp:432–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430static AnimationRTCache GAnimationRTCache;
431
432void AnimationRT::FullLoad(Skeleton* skelet, const char* file)
433{
434 QIFStreamB in;
435 in.AutoOpen(file);
436 if (in.fail() || in.rest() <= 0)
437 {
438 LOG_ERROR(Physics, "Animation {} not found or empty", file);
439 return;
440 }
441
442 Poseidon::Asset::Formats::RTMAnimation rtm;
443 if (!Poseidon::Asset::Formats::readRTM(in, rtm))
444 {
445 ErrorMessage("Bad animation file format in file '%s'.", file);
446 return;
447 }
448 int nSel = rtm.boneCount();
449 PoseidonAssert(_nPhases == rtm.phaseCount());
450 PoseidonAssert(_selections.Size() == nSel);
451 PoseidonAssert(_nPhases >= 1);
452
453 _phases.Resize(_nPhases);
454 _phaseTimes.Resize(_nPhases);
455 std::vector<int> boneMap(nSel);
456 int bonesUsed = 0;
457 for (int i = 0; i < nSel; i++)
458 {
459 int bone = skelet->FindBone(_selections[i]);
460 boneMap[i] = bone;
461 if (bonesUsed < bone + 1)
462 bonesUsed = bone + 1;
463 }
464 for (int i = 0; i < _nPhases; i++)
465 {
466 _phases[i]._matrix.Realloc(bonesUsed);
467 _phases[i]._matrix.Resize(bonesUsed);
468 _phaseTimes[i] = _phases[i].LoadFromRTM(rtm.phases[i], boneMap.data(), nSel, _reversed);
469 }
470 RemoveLoopFrame();
471}
472
473AnimationRT::~AnimationRT()
474{

Callers

nothing calls this directly

Calls 12

readRTMFunction · 0.85
ErrorMessageFunction · 0.85
AutoOpenMethod · 0.80
restMethod · 0.80
boneCountMethod · 0.80
phaseCountMethod · 0.80
FindBoneMethod · 0.80
LoadFromRTMMethod · 0.80
failMethod · 0.45
SizeMethod · 0.45
ResizeMethod · 0.45
ReallocMethod · 0.45

Tested by

no test coverage detected