summaryrefslogtreecommitdiff
path: root/src/factories/oot/OoTLimbFactory.h
blob: b9f88cca5c287327b8daba85c4fdd57835348b52 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once

#include "factories/BaseFactory.h"
#include "OoTSkeletonTypes.h"

namespace OoT {

class OoTLimbBinaryExporter : public BaseExporter {
    ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName,
                        YAML::Node& node, std::string* replacement) override;
};

class OoTLimbFactory : public BaseFactory {
public:
    std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override;
    std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
        return {
            REGISTER(Binary, OoTLimbBinaryExporter)
        };
    }

private:
    static size_t GetLimbDataSize(OoTLimbType type);
    void ParseLimbHeader(LUS::BinaryReader& reader, OoTLimbData& limb);
    void ParseCurveLimb(LUS::BinaryReader& reader, OoTLimbData& limb, const std::string& symbol);
    void ParseLegacyLimb(LUS::BinaryReader& reader, OoTLimbData& limb, const std::string& symbol);
    void ParseStandardLimb(LUS::BinaryReader& reader, OoTLimbData& limb, const std::string& symbol);
    void ParseLODLimb(LUS::BinaryReader& reader, OoTLimbData& limb, const std::string& symbol);
    void ParseSkinLimb(LUS::BinaryReader& reader, std::vector<uint8_t>& buffer,
                       OoTLimbData& limb, const std::string& symbol);
    void ParseAnimatedSkinData(std::vector<uint8_t>& buffer, uint32_t skinSegmentAddr,
                               OoTLimbData& limb, const std::string& symbol);
    void ParseSkinVertices(std::vector<uint8_t>& buffer, uint32_t addr, uint16_t count,
                           std::vector<OoTSkinVertex>& out);
    void ParseSkinTransformations(std::vector<uint8_t>& buffer, uint32_t addr, uint16_t count,
                                  std::vector<OoTSkinTransformation>& out);
};

} // namespace OoT