blob: 8cac1f792b66242b02ea038d5e71c1f2b83ae501 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include "SkeletonFactory.h"
#include "../type/Skeleton.h"
#include "spdlog/spdlog.h"
#include "ResourceUtil.h"
namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr<Ship::File> file) {
if (!FileHasValidFormatAndReader(file)) {
return nullptr;
}
auto skel = std::make_shared<Skeleton>(file->InitData);
auto reader = std::get<std::shared_ptr<Ship::BinaryReader>>(file->Reader);
auto count = reader->ReadUInt32();
for(size_t i = 0; i < count; i++) {
skel->mLimbs.push_back(LoadChild<LimbData*>(reader->ReadUInt64()));
}
skel->mLimbs.push_back(nullptr);
return skel;
}
} // namespace LUS
|