From f3269a49c474ffe4d382c3d60826ad1cfbb7cdc4 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 25 Nov 2022 17:28:07 -0800 Subject: Changeset: 93 Branch comment: [] Port font and UTF-8 string utilities from p6503 --- source/30-game/Texture.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'source/30-game/Texture.hpp') diff --git a/source/30-game/Texture.hpp b/source/30-game/Texture.hpp index 108dfa7..2931724 100644 --- a/source/30-game/Texture.hpp +++ b/source/30-game/Texture.hpp @@ -19,17 +19,19 @@ struct Subregion { float v1 = 0.0f; }; -struct TextureInfo { - glm::ivec2 size; - Tags::TexFilter minifyingFilter = Tags::TF_Linear; - Tags::TexFilter magnifyingFilter = Tags::TF_Linear; +struct TextureProperties { + // All [In] fields should be set by the user before initializing the texture + // All [Out] fields will be set by the initialization process, and any previously user-set value will be ignored + /* [In] */ Tags::TexFilter minifyingFilter = Tags::TF_Linear; + /* [In] */ Tags::TexFilter magnifyingFilter = Tags::TF_Linear; + /* [Out] */ glm::ivec2 size; }; class Texture : public RefCounted { friend class TextureStitcher; private: - TextureInfo mInfo; + TextureProperties mProps; GLuint mHandle = 0; public: @@ -47,9 +49,8 @@ public: EC_FileIoFailed, EC_InvalidImage, }; - - ErrorCode InitFromFile(const char* filePath); - ErrorCode InitFromImage(const Image& image); + ErrorCode InitFromFile(const char* filePath, const TextureProperties& props = {}); + ErrorCode InitFromImage(const Image& image, const TextureProperties& props = {}); struct AtlasSource { std::string name; @@ -77,7 +78,7 @@ public: }; ErrorCode InitAtlas(const AtlasInput& in, AtlasOutput* out = nullptr); - const TextureInfo& GetInfo() const; + const TextureProperties& GetInfo() const; GLuint GetHandle() const; bool IsValid() const; -- cgit v1.2.3-70-g09d2