1#ifndef OE_RENDER_TEXTURE_MANAGER_H
2#define OE_RENDER_TEXTURE_MANAGER_H
10#include <glm/vec3.hpp>
27 glm::vec3
color1 = glm::vec3(0.0f, 0.0f, 0.0f);
32 glm::vec3
color2 = glm::vec3(1.0f, 0.0f, 1.0f);
64 return &_dummy_texture;
75 return &_dummy_texture;
100 template <
typename T =
Texture,
typename... Args>
103 if (name.length() == 0)
105 throw std::invalid_argument(
"Texture name is missing!");
110 throw std::invalid_argument(
"Texture " + name +
"already exists!");
113 _textures[name] = std::make_unique<T>(std::forward<Args>(args)...);
115 return _textures[name].get();
146 return &_dummy_cubemap;
157 return &_dummy_cubemap;
164 template <
typename T =
Cubemap,
typename... Args>
167 if (name.length() == 0)
169 throw std::invalid_argument(
"Cubemap name is missing!");
174 throw std::invalid_argument(
"Cubemap " + name +
"already exists!");
177 _cubemaps[name] = std::make_unique<T>(std::forward<Args>(args)...);
179 return _cubemaps[name].get();
196 std::map<std::string, std::unique_ptr<Texture>> _textures;
197 std::map<std::string, std::unique_ptr<Cubemap>> _cubemaps;
Standard shader class.
Definition shader.h:23
handles the load and deletion of textures/cubemaps
Definition texture_manager.h:49
bool hasCubemap(const std::string &name) const
Check if a cubemap is registered.
Texture * getDefaultTexture()
Get dummy texture.
Definition texture_manager.h:73
TextureManager(const TextureManagerCreateInfo &={})
Constructor.
Cubemap * getCubemap(const std::string &name)
Get a cubemap by name.
Texture * registerTexture(const std::string &name, Args &&... args)
Generate and register a texture by calling texture constructor.
Definition texture_manager.h:101
Cubemap * registerCubemap(const std::string &name, Args &&... args)
Generate and register a cubemap by calling cubemap constructor.
Definition texture_manager.h:165
bool hasTexture(const std::string &name) const
Check if a texture is registered.
const Texture * getDefaultTexture() const
Get dummy texture.
Definition texture_manager.h:62
Texture * getTexture(const std::string &name)
Get a texture by name.
Cubemap * getDefaultCubemap()
Get dummy cubemap.
Definition texture_manager.h:155
const Texture * getTexture(const std::string &name) const
Get a texture by name.
bool removeTexture(const std::string &name)
Remove a registered texture.
const Cubemap * getCubemap(const std::string &name) const
Get a cubemap by name.
static void setVerticalFlipOnLoad(const bool flip)
Set if textures should be flipped upon image load.
const Cubemap * getDefaultCubemap() const
Get dummy cubemap.
Definition texture_manager.h:144
bool removeCubemap(const std::string &name)
Remove a registered cubemap.
Input/Output abstractions (Filesystem, Network, ...)
Definition file.h:10
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10
Settings to create a checkerboard texture.
Definition texture_manager.h:23
glm::vec3 color2
Second color of the default texture checkerboard pattern, magenta by default.
Definition texture_manager.h:32
glm::vec3 color1
First color of the default texture checkerboard pattern, black by default.
Definition texture_manager.h:27
Settings to create the texture manager.
Definition texture_manager.h:39