Radium Engine  1.5.0
TextureManager.hpp
1 #pragma once
2 
3 #include <Engine/RaEngine.hpp>
4 #include <map>
5 #include <string>
6 
7 #include <Engine/Data/Texture.hpp>
8 #include <Engine/OpenGL.hpp>
9 namespace Ra {
10 namespace Engine {
11 namespace Data {
12 
18 class RA_ENGINE_API TextureManager final
19 {
20 
21  private:
22  using TexturePair = std::pair<std::string, Texture*>;
23 
24  public:
36  TextureParameters& addTexture( const std::string& name, uint width, uint height, void* data );
37 
57  Texture* getOrLoadTexture( const TextureParameters& texParameters, bool linearize = false );
58 
63  Texture* loadTexture( const TextureParameters& texParameters, bool linearize = false );
64 
69  void deleteTexture( const std::string& filename );
74  void deleteTexture( Texture* texture );
75 
83  void updateTextureContent( const std::string& texture, void* content );
84 
95  void updatePendingTextures();
96 
102  void loadTextureImage( TextureParameters& texParameters );
103 
104  public:
105  TextureManager();
106  ~TextureManager();
107 
108  private:
110  std::map<std::string, Texture*> m_textures;
112  std::map<std::string, TextureParameters> m_pendingTextures;
114  std::map<std::string, void*> m_pendingData;
115 };
116 
117 } // namespace Data
118 } // namespace Engine
119 } // namespace Ra
Definition: Cage.cpp:3