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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#pragma once
#include "factories/BaseFactory.h"
#include <vector>
#include <string>
#include <optional>
namespace OoT {
struct CollisionVertex {
int16_t x, y, z;
};
struct CollisionPoly {
uint16_t type;
uint16_t vtxA;
uint16_t vtxB;
uint16_t vtxC;
uint16_t normX;
uint16_t normY;
uint16_t normZ;
uint16_t dist;
};
struct SurfaceType {
uint32_t data0;
uint32_t data1;
};
struct CamDataEntry {
uint16_t cameraSType;
int16_t numData;
uint32_t cameraPosIndex;
};
struct CamPosData {
int16_t x, y, z;
};
struct WaterBox {
int16_t xMin;
int16_t ySurface;
int16_t zMin;
int16_t xLength;
int16_t zLength;
uint32_t properties;
};
class OoTCollisionData : public IParsedData {
public:
int16_t absMinX, absMinY, absMinZ;
int16_t absMaxX, absMaxY, absMaxZ;
std::vector<CollisionVertex> vertices;
std::vector<CollisionPoly> polygons;
std::vector<SurfaceType> surfaceTypes;
std::vector<CamDataEntry> camDataEntries;
std::vector<CamPosData> camPositions;
std::vector<WaterBox> waterBoxes;
};
class OoTCollisionBinaryExporter : public BaseExporter {
ExportResult Export(std::ostream& write, std::shared_ptr<IParsedData> data, std::string& entryName,
YAML::Node& node, std::string* replacement) override;
};
class OoTCollisionFactory : 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, OoTCollisionBinaryExporter)
};
}
};
} // namespace OoT
|