From b8bcb110c2fba991cad049743073ffc7ece1143e Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Wed, 21 Feb 2024 20:51:00 -0600 Subject: [PATCH] Fixed byte size on rgba16/rgba32 textures --- src/factories/TextureFactory.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/factories/TextureFactory.cpp b/src/factories/TextureFactory.cpp index 4f21c74..6aa4f82 100644 --- a/src/factories/TextureFactory.cpp +++ b/src/factories/TextureFactory.cpp @@ -93,7 +93,8 @@ void TextureHeaderExporter::Export(std::ostream &write, std::shared_ptr raw, std::string& entryName, YAML::Node &node, std::string* replacement) { - auto data = std::static_pointer_cast(raw)->mBuffer; + auto texture = std::static_pointer_cast(raw); + auto data = texture->mBuffer; auto symbol = GetSafeNode(node, "symbol", entryName); auto format = GetSafeNode(node, "format"); @@ -107,12 +108,22 @@ void TextureCodeExporter::Export(std::ostream &write, std::shared_ptrmFormat.depth / 8)); + + SPDLOG_INFO("Byte Size: {}", byteSize); + + for (int i = 0; i < data.size(); i+=byteSize) { if (i % 16 == 0 && i != 0) { file << std::endl; } - file << "0x" << std::hex << std::setw(2) << std::setfill('0') << static_cast(data[i]) << ", "; + file << "0x"; + + for (int j = 0; j < byteSize; j++) { + file << std::hex << std::setw(2) << std::setfill('0') << static_cast(data[i + j]); + } + + file << ", "; } file << std::endl;