From f9a6541ed99f1c72ba34a91705a48e205b159390 Mon Sep 17 00:00:00 2001 From: Derpius <49565664+Derpius@users.noreply.github.com> Date: Sun, 10 Nov 2024 15:23:22 +0000 Subject: [PATCH] Expose VTF texture flags --- src/vtf.cpp | 10 +++++++--- src/vtf.hpp | 6 ++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/vtf.cpp b/src/vtf.cpp index 06f236f..1862408 100644 --- a/src/vtf.cpp +++ b/src/vtf.cpp @@ -101,9 +101,9 @@ namespace VtfParser { size_t size = 0; for (uint8_t mipLevel = 0; mipLevel < sizeInfo.mipLevels; mipLevel++) { ImageSizeInfo mipSizeInfo = sizeInfo; - mipSizeInfo.width = std::max(sizeInfo.width >> mipLevel, 1ull); - mipSizeInfo.height = std::max(sizeInfo.height >> mipLevel, 1ull); - mipSizeInfo.depth = std::max(sizeInfo.depth >> mipLevel, 1ull); + mipSizeInfo.width = std::max(sizeInfo.width >> mipLevel, 1ul); + mipSizeInfo.height = std::max(sizeInfo.height >> mipLevel, 1ul); + mipSizeInfo.depth = std::max(sizeInfo.depth >> mipLevel, 1ul); size += getMipSizeBytes(mipSizeInfo); } @@ -205,6 +205,10 @@ namespace VtfParser { return header.firstFrame; } + TextureFlags Vtf::getFlags() const { + return header.flags; + } + std::span Vtf::getHighResImageData() const { return highResImageData; } diff --git a/src/vtf.hpp b/src/vtf.hpp index f25702d..e055b75 100644 --- a/src/vtf.hpp +++ b/src/vtf.hpp @@ -86,6 +86,12 @@ namespace VtfParser { */ [[nodiscard]] uint16_t getFirstFrame() const; + /** + * Gets the flags set on the texture. + * @return TextureFlags packed together as a bitflag. + */ + [[nodiscard]] TextureFlags getFlags() const; + /** * Gets the high resolution image data. * @return View over the high-res data.