| 430 | static AnimationRTCache GAnimationRTCache; |
| 431 | |
| 432 | void 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 | |
| 473 | AnimationRT::~AnimationRT() |
| 474 | { |
nothing calls this directly
no test coverage detected