1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-01-15 12:47:04 +00:00
oot/tools/ZAPD/ZAPD/ZVtx.cpp
EllipticEllipsis 9b67778a00
Building on Macs (#1086)
* git subrepo pull (merge) tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "945e6ca1a"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "50242eca9"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* Fix extract_assets.py multithreading

* Update binutils doc a bit

* Remove * import, add multiprocessing option
and way to pass arguments to ZAPD

* Update format.sh to be more platform-independent

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "fd5a7f434"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "fd5a7f434"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* Remove ;

* Update formatting script to not just use 11

* Add Python requirements,
move the Mac stuff in the README into its own doc

* Fix readme link

* Minor format thing

* .

* Move ZAPDArgs into its own function

* Update readme and remove requirements.txt

* Dragorn-inspired rewrite of processZAPDArgs

* git subrepo pull --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "a0d3f7b68"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "a0d3f7b68"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"

* Fix function definition

* Building docs overhaul

* Add Python packages to Mac and Cygwin

* Heading number

* format format.sh (!)

* Replace "currently"

* Remove Debian

* git subrepo pull (merge) --force tools/ZAPD

subrepo:
  subdir:   "tools/ZAPD"
  merged:   "0ba781304"
upstream:
  origin:   "https://github.com/zeldaret/ZAPD.git"
  branch:   "master"
  commit:   "0ba781304"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo.git"
  commit:   "2f68596"
2022-01-16 19:43:07 -05:00

86 lines
1.7 KiB
C++

#include "ZVtx.h"
#include "Utils/BitConverter.h"
#include "Utils/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::ParseRawData()
{
ZResource::ParseRawData();
const auto& rawData = parent->GetRawData();
x = BitConverter::ToInt16BE(rawData, rawDataIndex + 0);
y = BitConverter::ToInt16BE(rawData, rawDataIndex + 2);
z = BitConverter::ToInt16BE(rawData, rawDataIndex + 4);
flag = BitConverter::ToInt16BE(rawData, rawDataIndex + 6);
s = BitConverter::ToInt16BE(rawData, rawDataIndex + 8);
t = BitConverter::ToInt16BE(rawData, rawDataIndex + 10);
r = rawData[rawDataIndex + 12];
g = rawData[rawDataIndex + 13];
b = rawData[rawDataIndex + 14];
a = rawData[rawDataIndex + 15];
}
Declaration* ZVtx::DeclareVar(const std::string& prefix, const std::string& bodyStr)
{
Declaration* decl = ZResource::DeclareVar(prefix, bodyStr);
decl->isExternal = true;
return decl;
}
std::string ZVtx::GetBodySourceCode() const
{
return StringHelper::Sprintf("VTX(%i, %i, %i, %i, %i, %i, %i, %i, %i)", x, y, z, s, t, r, g, b,
a);
}
size_t ZVtx::GetRawDataSize() const
{
return 16;
}
bool ZVtx::DoesSupportArray() const
{
return true;
}
ZResourceType ZVtx::GetResourceType() const
{
return ZResourceType::Vertex;
}
bool ZVtx::IsExternalResource() const
{
return true;
}
std::string ZVtx::GetSourceTypeName() const
{
return "Vtx";
}
std::string ZVtx::GetExternalExtension() const
{
return "vtx";
}
DeclarationAlignment ZVtx::GetDeclarationAlignment() const
{
return DeclarationAlignment::Align8;
}