diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2023-05-05 18:24:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-05 18:24:21 -0400 |
| commit | a8874cf4a6274ff3a0388fb08d43a91b620d3618 (patch) | |
| tree | 3a1b6d995ab77b3b2649a74f7af169f96ea5f9cf /ZAPD/ZTexture.h | |
| parent | ecc25616ec90e14f3ddcf3c703b7a29d6ccf1f95 (diff) | |
Refactor - Clean up ZTexture, ZFile, and Main (#292)
* ZTexture and ZFile cleanup
* Moved Exporter Set into its own file
* Some minor renaming
* Arguments handled through dictionary instead of if else chain
* Build error fix
Diffstat (limited to 'ZAPD/ZTexture.h')
| -rw-r--r-- | ZAPD/ZTexture.h | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/ZAPD/ZTexture.h b/ZAPD/ZTexture.h index 1601897..cf85edf 100644 --- a/ZAPD/ZTexture.h +++ b/ZAPD/ZTexture.h @@ -30,26 +30,28 @@ protected: ZTexture* tlut = nullptr; bool splitTlut; - void PrepareBitmapRGBA16(); - void PrepareBitmapRGBA32(); - void PrepareBitmapGrayscale8(); - void PrepareBitmapGrayscaleAlpha8(); - void PrepareBitmapGrayscale4(); - void PrepareBitmapGrayscaleAlpha4(); - void PrepareBitmapGrayscaleAlpha16(); - void PrepareBitmapPalette4(); - void PrepareBitmapPalette8(); + // The following functions convert from N64 binary data to a bitmap to be saved to a PNG. + void ConvertN64ToBitmap_RGBA16(); + void ConvertN64ToBitmap_RGBA32(); + void ConvertN64ToBitmap_Grayscale8(); + void ConvertN64ToBitmap_GrayscaleAlpha8(); + void ConvertN64ToBitmap_Grayscale4(); + void ConvertN64ToBitmap_GrayscaleAlpha4(); + void ConvertN64ToBitmap_GrayscaleAlpha16(); + void ConvertN64ToBitmap_Palette4(); + void ConvertN64ToBitmap_Palette8(); + // The following functions convert from a bitmap to N64 binary data. void PrepareRawDataFromFile(const fs::path& inFolder); - void PrepareRawDataRGBA16(); - void PrepareRawDataRGBA32(); - void PrepareRawDataGrayscale4(); - void PrepareRawDataGrayscale8(); - void PrepareRawDataGrayscaleAlpha4(); - void PrepareRawDataGrayscaleAlpha8(); - void PrepareRawDataGrayscaleAlpha16(); - void PrepareRawDataPalette4(); - void PrepareRawDataPalette8(); + void ConvertBitmapToN64_RGBA16(); + void ConvertBitmapToN64_RGBA32(); + void ConvertBitmapToN64_Grayscale4(); + void ConvertBitmapToN64_Grayscale8(); + void ConvertBitmapToN64_GrayscaleAlpha4(); + void ConvertBitmapToN64_GrayscaleAlpha8(); + void ConvertBitmapToN64_GrayscaleAlpha16(); + void ConvertBitmapToN64_Palette4(); + void ConvertBitmapToN64_Palette8(); public: ZTexture(ZFile* nParent); @@ -68,7 +70,12 @@ public: Declaration* DeclareVar(const std::string& prefix, const std::string& bodyStr) override; std::string GetBodySourceCode() const override; + + /// <summary> + /// Calculates the hash of this texture, for use with the texture pool. + /// </summary> void CalcHash() override; + void Save(const fs::path& outFolder) override; std::string GetHeaderDefines() const; @@ -84,10 +91,28 @@ public: uint32_t GetWidth() const; uint32_t GetHeight() const; void SetDimensions(uint32_t nWidth, uint32_t nHeight); + + /// <summary> + /// Returns how many bytes each pixel takes up. + /// </summary> + /// <returns></returns> float GetPixelMultiplyer() const; + TextureType GetTextureType() const; + + /// <summary> + /// Returns the path to the texture pool, taken from the config file. + /// </summary> + /// <param name="defaultValue"></param> + /// <returns></returns> fs::path GetPoolOutPath(const fs::path& defaultValue); + + /// <summary> + /// Returns if this texture uses a palette. + /// </summary> + /// <returns></returns> bool IsColorIndexed() const; + void SetTlut(ZTexture* nTlut); bool HasTlut() const; void ParseRawDataLate() override; |
