summaryrefslogtreecommitdiff
path: root/src/factories/sm64/AnimationFactory.h
blob: 2d0ea4595b8b48bf1df79de339c1a4c28cfd70ea (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
#pragma once

#include "../BaseFactory.h"

namespace SM64 {
class AnimationData : public IParsedData {
public:
    int16_t mFlags;
    int16_t mAnimYTransDivisor;
    int16_t mStartFrame;
    int16_t mLoopStart;
    int16_t mLoopEnd;
    int16_t mUnusedBoneCount;
    int16_t mLength;
    std::vector<uint16_t> mIndices;
    std::vector<uint16_t> mEntries;

    AnimationData(int16_t flags, int16_t animYTransDivisor, int16_t startFrame, int16_t loopStart, int16_t loopEnd, int16_t unusedBoneCount, int16_t length, std::vector<uint16_t>& indices, std::vector<uint16_t>& entries) : mFlags(flags), mAnimYTransDivisor(animYTransDivisor), mStartFrame(startFrame), mLoopStart(loopStart), mLoopEnd(loopEnd), mUnusedBoneCount(unusedBoneCount), mLength(length), mIndices(indices), mEntries(entries) {}
};

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

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