111 const std::string& name,
112 const std::string& path);
118 auto it = m_textures.find(name);
119 if(
it == m_textures.end())
122 "Texture \"%s\" not found. This is probably the result of a developer mistyping a texture ID.\n",
126 return it->second->GetTexture();
129 std::unique_ptr<vk::raii::Sampler>& GetSampler()
132 std::unique_ptr<vk::raii::Sampler>& GetNearestSampler()
133 {
return m_nearestSampler; }
136 { m_textures.clear(); }
138 vk::raii::CommandBuffer& GetCmdBuffer()
139 {
return *m_cmdBuf; }
141 std::shared_ptr<QueueHandle> GetQueue()
144 vk::ImageView GetView(
const std::string& name)
145 {
return m_textures[name]->GetView(); }
150 const std::string& path,
157 std::map<std::string, std::shared_ptr<Texture> > m_textures;
162 std::unique_ptr<vk::raii::Sampler> m_nearestSampler;
164 std::shared_ptr<QueueHandle> m_queue;
165 std::unique_ptr<vk::raii::CommandPool> m_cmdPool;
166 std::unique_ptr<vk::raii::CommandBuffer> m_cmdBuf;
Manages loading and saving texture resources to files.
Definition TextureManager.h:105
png_structp LoadPNG(const std::string &path, size_t &width, size_t &height, FILE *&fp, png_infop &info, png_infop &end)
Helper function to initialize libpng and get header info.
Definition TextureManager.cpp:343
std::unique_ptr< vk::raii::Sampler > m_sampler
Sampler for textures.
Definition TextureManager.h:160
void LoadTexture(const std::string &name, const std::string &path)
Loads a texture from a file into a named resource.
Definition TextureManager.cpp:471
GLFWimage LoadPNGToGLFWImage(const std::string &path)
Loads a PNG to a GLFWimage.
Definition TextureManager.cpp:427
Encapsulates the various Vulkan objects we need to represent texture image memory.
Definition TextureManager.h:48
std::unique_ptr< vk::raii::ImageView > m_view
View of the image.
Definition TextureManager.h:93
std::unique_ptr< vk::raii::DeviceMemory > m_deviceMemory
Device memory backing the image.
Definition TextureManager.h:98
vk::raii::Image m_image
Image object for our texture.
Definition TextureManager.h:90