aboutsummaryrefslogtreecommitdiff
path: root/apps/openmb/renderer/TextureManager.hpp
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /apps/openmb/renderer/TextureManager.hpp
move to own git serverHEADmaster
Diffstat (limited to 'apps/openmb/renderer/TextureManager.hpp')
-rw-r--r--apps/openmb/renderer/TextureManager.hpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/apps/openmb/renderer/TextureManager.hpp b/apps/openmb/renderer/TextureManager.hpp
new file mode 100644
index 0000000..f3e183f
--- /dev/null
+++ b/apps/openmb/renderer/TextureManager.hpp
@@ -0,0 +1,64 @@
+#ifndef OPENMB_APPS_OPENMB_RENDERER_TEXTUREMANAGER_H
+#define OPENMB_APPS_OPENMB_RENDERER_TEXTUREMANAGER_H
+
+#include "Texture.hpp"
+
+#include <filesystem>
+#include <map>
+#include <string>
+#include <vector>
+
+namespace renderer {
+
+class TextureManager {
+ public:
+ TextureManager();
+ ~TextureManager() = default;
+
+ void scanDirectory( const std::string& basePath );
+
+ std::vector<std::string> getCategories() const;
+
+ std::vector<std::string> getSubcategories( const std::string& category ) const;
+
+ std::vector<std::string> getTextureNames( const std::string& category, const std::string& subcategory ) const;
+
+ Texture* getTexture( const std::string& category, const std::string& subcategory,
+ const std::string& textureName );
+
+ Texture* getCurrentTexture();
+
+ void setCurrentTexture( const std::string& category, const std::string& subcategory,
+ const std::string& textureName );
+
+ const std::string& getCurrentCategory () const { return mCurrentCategory; }
+ const std::string& getCurrentSubcategory () const { return mCurrentSubcategory; }
+ const std::string& getCurrentTextureName () const { return mCurrentTextureName; }
+
+ int getCurrentTextureId() const;
+
+ Texture* getTextureById( int textureId );
+
+ private:
+ struct TextureEntry {
+ std::string mFullPath;
+ Texture mTexture;
+ bool mLoaded;
+ };
+
+ std::string mBasePath;
+
+ std::map<std::string, std::map<std::string, std::map<std::string, TextureEntry>>> mTextures;
+
+ std::string mCurrentCategory;
+ std::string mCurrentSubcategory;
+ std::string mCurrentTextureName;
+ Texture* mCurrentTexture;
+ int mCurrentTextureId;
+
+ std::map<int, std::tuple<std::string, std::string, std::string>> mTextureIdToPath;
+ int mNextTextureId;
+};
+} // namespace renderer
+
+#endif