1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-16 20:10:28 +00:00
oot/tools/ZAPD/ZAPD/ZVtx.cpp
Nicholas Estelami 0432011bd9
Updated to use latest version of ZAPD (#777)
* Updated config file

* Added missing files

* Temporarily removed asm_processor changes.

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "96ffc1e62"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "96ffc1e62"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "179af7d11"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "179af7d11"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Cleanup and fixes.

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "50ad2fe78"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "50ad2fe78"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

* Makefile fix

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "b9120803e"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "b9120803e"
git-subrepo:
  version:  "0.4.3"
  origin:   "???"
  commit:   "???"

Co-authored-by: Jack Walker <7463599+Jack-Walker@users.noreply.github.com>
2021-04-30 23:23:22 +02:00

92 lines
1.8 KiB
C++

#include "ZVtx.h"
#include "BitConverter.h"
#include "StringHelper.h"
#include "ZFile.h"
REGISTER_ZFILENODE(Vtx, ZVtx);
ZVtx::ZVtx(ZFile* nParent) : ZResource(nParent)
{
x = 0;
y = 0;
z = 0;
flag = 0;
s = 0;
t = 0;
r = 0;
g = 0;
b = 0;
a = 0;
}
void ZVtx::ParseXML(tinyxml2::XMLElement* reader)
{
}
std::string ZVtx::GetSourceTypeName()
{
return "Vtx";
}
std::string ZVtx::GetSourceOutputCode(const std::string& prefix)
{
std::string output =
StringHelper::Sprintf("VTX(%i, %i, %i, %i, %i, %i, %i, %i, %i)", x, y, z, s, t, r, g, b, a);
if (parent != nullptr)
{
Declaration* decl =
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align16, GetRawDataSize(),
GetSourceTypeName(), name, output);
decl->isExternal = true;
}
return "";
}
void ZVtx::ParseRawData()
{
const uint8_t* data = rawData.data();
x = BitConverter::ToInt16BE(data, rawDataIndex + 0);
y = BitConverter::ToInt16BE(data, rawDataIndex + 2);
z = BitConverter::ToInt16BE(data, rawDataIndex + 4);
flag = BitConverter::ToInt16BE(data, rawDataIndex + 6);
s = BitConverter::ToInt16BE(data, rawDataIndex + 8);
t = BitConverter::ToInt16BE(data, rawDataIndex + 10);
r = data[rawDataIndex + 12];
g = data[rawDataIndex + 13];
b = data[rawDataIndex + 14];
a = data[rawDataIndex + 15];
}
size_t ZVtx::GetRawDataSize()
{
return 16;
}
bool ZVtx::DoesSupportArray()
{
return true;
}
ZResourceType ZVtx::GetResourceType()
{
return ZResourceType::Vertex;
}
bool ZVtx::IsExternalResource()
{
return true;
}
std::string ZVtx::GetExternalExtension()
{
return "vtx";
}
void ZVtx::ExtractFromXML(tinyxml2::XMLElement* reader, const std::vector<uint8_t>& nRawData,
const uint32_t nRawDataIndex, const std::string& nRelPath)
{
ZResource::ExtractFromXML(reader, nRawData, nRawDataIndex, nRelPath);
}