Torch
Loading...
Searching...
No Matches
GeoLayoutFactory.h
1#pragma once
2
3#include <factories/BaseFactory.h>
4#include "geo/GeoCommand.h"
5#include <vector>
6#include <variant>
7
8typedef std::variant<uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, Vec2f, Vec3f, Vec3s, Vec3i, Vec4f, Vec4s, std::string> GeoArgument;
9
10enum class GeoArgumentType {
11 U8, S8, U16, S16, U32, S32, U64, VEC2F, VEC3F, VEC3S, VEC3I, VEC4F, VEC4S, STRING
12};
13
14namespace SM64 {
15
16struct GeoCommand {
17 GeoOpcode opcode;
18 std::vector<GeoArgument> arguments;
19 bool skipped;
20};
21
22class GeoLayout : public IParsedData {
23public:
24 std::vector<GeoCommand> commands;
25
26 explicit GeoLayout(std::vector<GeoCommand> commands) : commands(std::move(commands)) {}
27};
28
30 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
31};
32
34 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
35};
36
38 ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName, YAML::Node& node, std::string* replacement) override;
39};
40
41class GeoLayoutFactory : public BaseFactory {
42public:
43 GeoLayoutFactory();
44
45 std::optional<std::shared_ptr<IParsedData>> parse(std::vector<uint8_t>& buffer, YAML::Node& data) override;
46 std::unordered_map<ExportType, std::shared_ptr<BaseExporter>> GetExporters() override {
47 return {
48 REGISTER(Header, GeoHeaderExporter)
49 REGISTER(Binary, GeoBinaryExporter)
50 REGISTER(Code, GeoCodeExporter)
51 };
52 }
53};
54}
Definition BaseFactory.h:88
Definition BaseFactory.h:94
Definition BaseFactory.h:80
Definition GeoLayoutFactory.h:37
Definition GeoLayoutFactory.h:29
Definition GeoLayoutFactory.h:33
Definition GeoLayoutFactory.h:16