Radium Engine
1.5.20
|
Manage Texture loading and registration. More...
#include <Engine/Data/TextureManager.hpp>
Public Types | |
using | TextureHandle = Ra::Core::Utils::Index |
Public Member Functions | |
TextureHandle | addTexture (const TextureParameters &p) |
Add a texture given its TextureParameters. | |
Texture * | getTexture (const TextureHandle &handle) |
Get raw texture ptr from handle. | |
TextureHandle | getTextureHandle (const std::string &name) |
Get a texture handle from textue name. | |
Texture * | getTexture (const std::string &name) |
Convinience function to obtain Texture ptr from name. | |
void | deleteTexture (const TextureHandle &handle) |
Remove a managed texture identified by handle. | |
TextureManager (TextureManager const &)=delete | |
TextureManager (TextureManager &&)=delete | |
TextureManager & | operator= (TextureManager const &)=delete |
TextureManager & | operator= (TextureManager &&)=delete |
Static Public Member Functions | |
static ImageParameters | loadTextureImage (const std::string &filename, bool linearize=false) |
Load filename and fill ImageParameters according to filename content. | |
Manage Texture loading and registration.
TextureManager allows to store texture globally such that different object can share textures based on their handle or name. Name uniqueness is not guaranteed by the manager, take care in case of search texture by name.
Definition at line 19 of file TextureManager.hpp.
using Ra::Engine::Data::TextureManager::TextureHandle = Ra::Core::Utils::Index |
Definition at line 24 of file TextureManager.hpp.
TextureManager::TextureHandle Ra::Engine::Data::TextureManager::addTexture | ( | const TextureParameters & | p | ) |
Add a texture given its TextureParameters.
Definition at line 21 of file TextureManager.cpp.
void Ra::Engine::Data::TextureManager::deleteTexture | ( | const TextureHandle & | handle | ) |
Remove a managed texture identified by handle.
Texture dtor will register the delete texture gpu task.
Definition at line 104 of file TextureManager.cpp.
|
inline |
Convinience function to obtain Texture ptr from name.
Definition at line 46 of file TextureManager.hpp.
Texture * Ra::Engine::Data::TextureManager::getTexture | ( | const TextureHandle & | handle | ) |
Get raw texture ptr from handle.
The texture is still managed by the manager. Do not delete the return ptr.
Definition at line 91 of file TextureManager.cpp.
TextureManager::TextureHandle Ra::Engine::Data::TextureManager::getTextureHandle | ( | const std::string & | name | ) |
Get a texture handle from textue name.
It search for the first texture in the set of managed texture that have this name.
Definition at line 95 of file TextureManager.cpp.
|
static |
Load filename and fill ImageParameters according to filename content.
filename | fully qualified image filename. See stbi_load_image for supported file format. |
Definition at line 41 of file TextureManager.cpp.