Manages the textures available in the component. More...
Public Member Functions | |
~TextureManager () | |
Texture * | createOrRetrieve (const nkMemory::StringView &name) |
Texture * | get (const nkMemory::StringView &name) |
Texture * | getByIndex (unsigned int id) |
void | rename (const nkMemory::StringView ¤tName, const nkMemory::StringView &newName) |
void | erase (const nkMemory::StringView &name) |
void | setActiveRenderTarget (Texture *target) |
void | setActiveDepthTarget (Texture *target) |
Texture * | getActiveRenderTarget () const |
Texture * | getDepthTarget () const |
Manages the textures available in the component.
At all times, manager owns any memory allocated inside. External code should never delete memory returned by it.
nkGraphics::TextureManager::~TextureManager | ( | ) |
Destructor.
Texture* nkGraphics::TextureManager::createOrRetrieve | ( | const nkMemory::StringView & | name | ) |
Creates if unavailable, or retrieves if available, a texture.
name | The name of the texture to retrieve. |
Texture* nkGraphics::TextureManager::get | ( | const nkMemory::StringView & | name | ) |
Retrieves a texture.
name | The name of the texture to retrieve. |
Texture* nkGraphics::TextureManager::getByIndex | ( | unsigned int | id | ) |
Get a texture, by index. Note that one index can map to a different texture after memory is changed. Useful to loop over all available textures in one go.
id | The index of the texture to retrieve. |
void nkGraphics::TextureManager::rename | ( | const nkMemory::StringView & | currentName, |
const nkMemory::StringView & | newName | ||
) |
Renames a texture.
currentName | The name of the texture to rename. |
newName | The name to reassign to the texture. |
void nkGraphics::TextureManager::erase | ( | const nkMemory::StringView & | name | ) |
Erases and frees a texture.
name | The name of the texture to erase. |
void nkGraphics::TextureManager::setActiveRenderTarget | ( | Texture * | target | ) |
Sets the active render target. Used during rendering to feed data to the shaders, for instance.
target | The target to flag as active. |
void nkGraphics::TextureManager::setActiveDepthTarget | ( | Texture * | target | ) |
Sets the active depth render target. Used during rendering to feed data to the shaders, for instance.
target | The target to flag as active. |
Texture* nkGraphics::TextureManager::getActiveRenderTarget | ( | ) | const |
Texture* nkGraphics::TextureManager::getDepthTarget | ( | ) | const |