[OTR] Initial support for PNG textures (#1634)

This commit is contained in:
Garrett Cox 2022-10-01 15:33:29 -05:00 committed by GitHub
commit ec88b90ed8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 59 additions and 327 deletions

View file

@ -93,7 +93,27 @@ static void ExporterProgramEnd()
for (auto item : lst)
{
std::vector<std::string> splitPath = StringHelper::Split(item, ".");
if (splitPath.size() >= 3) {
std::string extension = splitPath.at(splitPath.size() - 1);
std::string format = splitPath.at(splitPath.size() - 2);
splitPath.pop_back();
splitPath.pop_back();
std::string afterPath = std::accumulate(splitPath.begin(), splitPath.end(), std::string(""));
if (extension == "png" && (format == "rgba32" || format == "rgb5a1" || format == "i4" || format == "i8" || format == "ia4" || format == "ia8" || format == "ia16" || format == "ci4" || format == "ci8")) {
Globals::Instance->buildRawTexture = true;
Globals::Instance->BuildAssetTexture(item, ZTexture::GetTextureTypeFromString(format), afterPath);
Globals::Instance->buildRawTexture = false;
auto fileData = File::ReadAllBytes(afterPath);
printf("otrArchive->AddFile(%s)\n", StringHelper::Split(afterPath, "Extract/")[1].c_str());
otrArchive->AddFile(StringHelper::Split(afterPath, "Extract/")[1], (uintptr_t)fileData.data(), fileData.size());
}
}
auto fileData = File::ReadAllBytes(item);
printf("otrArchive->AddFile(%s)\n", StringHelper::Split(item, "Extract/")[1].c_str());
otrArchive->AddFile(StringHelper::Split(item, "Extract/")[1], (uintptr_t)fileData.data(), fileData.size());
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB