1#ifndef OE_RENDER_TEXTURE_MANAGER_H
2#define OE_RENDER_TEXTURE_MANAGER_H
12#include <glm/vec3.hpp>
29 glm::vec3
color1 = glm::vec3(0.0f, 0.0f, 0.0f);
34 glm::vec3
color2 = glm::vec3(1.0f, 0.0f, 1.0f);
66 return _dummy_texture;
78 std::shared_ptr<Texture>
getTexture(
const std::string& name)
const;
85 template <
typename T =
Texture,
typename... Args>
88 if (name.length() == 0)
90 throw std::invalid_argument(
"Texture name is missing!");
95 throw std::invalid_argument(
"Texture " + name +
"already exists!");
98 std::shared_ptr<Texture> result = std::make_shared<T>(std::forward<Args>(args)...);
102 _textures[name] = result;
122 std::shared_ptr<Cubemap>
getCubemap(
const std::string& name)
const;
130 return _dummy_cubemap;
137 template <
typename T =
Cubemap,
typename... Args>
140 if (name.length() == 0)
142 throw std::invalid_argument(
"Cubemap name is missing!");
147 throw std::invalid_argument(
"Cubemap " + name +
"already exists!");
150 std::shared_ptr<Cubemap> result = std::make_shared<T>(std::forward<Args>(args)...);
154 _cubemaps[name] = result;
171 std::map<std::string, std::shared_ptr<Texture>> _textures;
172 std::map<std::string, std::shared_ptr<Cubemap>> _cubemaps;
173 std::shared_ptr<Texture> _dummy_texture;
174 std::shared_ptr<Cubemap> _dummy_cubemap;
Standard shader class.
Definition shader.h:26
handles the load and deletion of textures/cubemaps
Definition texture_manager.h:51
std::shared_ptr< Cubemap > getDefaultCubemap() const
Get dummy cubemap.
Definition texture_manager.h:128
bool hasCubemap(const std::string &name) const
Check if a cubemap is registered.
std::shared_ptr< Texture > getDefaultTexture() const
Get dummy texture.
Definition texture_manager.h:64
TextureManager(const TextureManagerCreateInfo &={})
Constructor.
std::shared_ptr< Cubemap > generateCubemap(const std::string &name, Args &&... args)
Generate and register a cubemap by calling cubemap constructor.
Definition texture_manager.h:138
bool hasTexture(const std::string &name) const
Check if a texture is registered.
std::shared_ptr< Texture > getTexture(const std::string &name) const
Get a texture by name.
bool removeTexture(const std::string &name)
Remove a registered texture.
static void setVerticalFlipOnLoad(const bool flip)
Set if textures should be flipped upon image load.
std::shared_ptr< Cubemap > getCubemap(const std::string &name) const
Get a cubemap by name.
bool removeCubemap(const std::string &name)
Remove a registered cubemap.
std::shared_ptr< Texture > registerTexture(const std::string &name, Args &&... args)
Generate and register a texture by calling texture constructor.
Definition texture_manager.h:86
Input/Output abstractions (Filesystem, Network, ...)
Definition file.h:14
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10
Settings to create a checkerboard texture.
Definition texture_manager.h:25
glm::vec3 color2
Second color of the default texture checkerboard pattern, magenta by default.
Definition texture_manager.h:34
glm::vec3 color1
First color of the default texture checkerboard pattern, black by default.
Definition texture_manager.h:29
Settings to create the texture manager.
Definition texture_manager.h:41