summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/factories/mk64/CourseVtx.cpp14
-rw-r--r--src/factories/mk64/CourseVtx.h10
2 files changed, 14 insertions, 10 deletions
diff --git a/src/factories/mk64/CourseVtx.cpp b/src/factories/mk64/CourseVtx.cpp
index d7bb122..118a35d 100644
--- a/src/factories/mk64/CourseVtx.cpp
+++ b/src/factories/mk64/CourseVtx.cpp
@@ -46,19 +46,19 @@ ExportResult MK64::CourseVtxCodeExporter::Export(std::ostream &write, std::share
write << fourSpaceTab;
}
- // {{{ x, y, z }, { tc1, tc2 }, { c1, c2, c3, c4 }}}
- write << "{{{" << NUM(x) << ", " << NUM(y) << ", " << NUM(z) << "}, " << NUM(flag) << " {" << NUM(tc1) << ", " << NUM(tc2) << "}, {" << COL(c1) << ", " << COL(c2) << ", " << COL(c3) << ", " << COL(c4) << "}}},\n";
+ // {{{ x, y, z }, f, { tc1, tc2 }, { c1, c2, c3, c4 }}}
+ write << "{{{" << NUM(x) << ", " << NUM(y) << ", " << NUM(z) << "}, " << NUM(f) << ", {" << NUM(tc1) << ", " << NUM(tc2) << "}, {" << COL(c1) << ", " << COL(c2) << ", " << COL(c3) << ", " << COL(c4) << "}}},\n";
}
write << "};\n";
- return offset + vtx.size() * sizeof(Vtx);
+ return offset + vtx.size() * sizeof(VtxRaw);
}
ExportResult MK64::CourseVtxBinaryExporter::Export(std::ostream &write, std::shared_ptr<IParsedData> raw, std::string& entryName, YAML::Node &node, std::string* replacement ) {
auto vtx = std::static_pointer_cast<CourseVtxData>(raw);
auto writer = LUS::BinaryWriter();
- WriteHeader(writer, LUS::ResourceType::Vtx, 0);
+ WriteHeader(writer, LUS::ResourceType::Vertex, 0);
writer.Write((uint32_t) vtx->mVtxs.size());
for(auto v : vtx->mVtxs) {
writer.Write(v.ob[0]);
@@ -84,7 +84,7 @@ std::optional<std::shared_ptr<IParsedData>> MK64::CourseVtxFactory::parse(std::v
LUS::BinaryReader reader(segment.data, count * sizeof(CourseVtx));
reader.SetEndianness(LUS::Endianness::Big);
- std::vector<Vtx> vertices;
+ std::vector<VtxRaw> vertices;
for(size_t i = 0; i < count; i++) {
const auto x = reader.ReadInt16();
@@ -102,11 +102,9 @@ std::optional<std::shared_ptr<IParsedData>> MK64::CourseVtxFactory::parse(std::v
cn1 &= 0xFC;
cn2 &= 0xFC;
-
- vertices->v.flag = flags;
cn4 = 0xFF;
- vertices.push_back(Vtx({
+ vertices.push_back(VtxRaw({
{x, y, z}, flag, {tc1, tc2}, {cn1, cn2, cn3, cn4}
}));
}
diff --git a/src/factories/mk64/CourseVtx.h b/src/factories/mk64/CourseVtx.h
index 729a86f..8c67808 100644
--- a/src/factories/mk64/CourseVtx.h
+++ b/src/factories/mk64/CourseVtx.h
@@ -10,12 +10,18 @@ namespace MK64 {
uint8_t cn[4]; /* color & alpha */
};
+ struct VtxRaw {
+ int16_t ob[3]; /* x, y, z */
+ uint16_t flag;
+ int16_t tc[2]; /* texture coord */
+ uint8_t cn[4]; /* color & alpha */
+ };
class CourseVtxData : public IParsedData {
public:
- std::vector<Vtx> mVtxs;
+ std::vector<VtxRaw> mVtxs;
- explicit CourseVtxData(std::vector<Vtx> vtxs) : mVtxs(vtxs) {}
+ explicit CourseVtxData(std::vector<VtxRaw> vtxs) : mVtxs(vtxs) {}
};
class CourseVtxHeaderExporter : public BaseExporter {