Shipwright/OTRExporter/OTRExporter/VtxExporter.cpp
M4xw 442a88f03b git subrepo clone https://github.com/HarbourMasters/OTRExporter.git
subrepo:
  subdir:   "OTRExporter"
  merged:   "1503d3eef"
upstream:
  origin:   "https://github.com/HarbourMasters/OTRExporter.git"
  branch:   "master"
  commit:   "1503d3eef"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2022-03-22 02:53:02 +01:00

45 lines
1.1 KiB
C++

#include "VtxExporter.h"
#include "Resource.h"
#include "VersionInfo.h"
void OTRExporter_Vtx::SaveArr(ZResource* res, const fs::path& outPath, const std::vector<ZResource*>& vec, BinaryWriter* writer)
{
WriteHeader(res, outPath, writer, Ship::ResourceType::Vertex);
for (auto& res: vec) {
ZVtx* vtx = (ZVtx*)res;
writer->Write(vtx->x);
writer->Write(vtx->y);
writer->Write(vtx->z);
writer->Write(vtx->flag);
writer->Write(vtx->s);
writer->Write(vtx->t);
writer->Write(vtx->r);
writer->Write(vtx->g);
writer->Write(vtx->b);
writer->Write(vtx->a);
}
}
void OTRExporter_Vtx::Save(ZResource* res, const fs::path& outPath, BinaryWriter* writer)
{
ZVtx* vtx = (ZVtx*)res;
WriteHeader(res, outPath, writer, Ship::ResourceType::Vertex);
writer->Write((uint32_t)1); //Yes I'm hard coding it to one, it *should* be fine.
writer->Write(vtx->x);
writer->Write(vtx->y);
writer->Write(vtx->z);
writer->Write(vtx->flag);
writer->Write(vtx->s);
writer->Write(vtx->t);
writer->Write(vtx->r);
writer->Write(vtx->g);
writer->Write(vtx->b);
writer->Write(vtx->a);
}