API Documentation
Public Member Functions | List of all members
nkGraphics::TextureManager Class Referencefinal

Manages the textures available in the component. More...

Inheritance diagram for nkGraphics::TextureManager:

Public Member Functions

 ~TextureManager ()
 
TexturecreateOrRetrieve (const nkMemory::StringView &name)
 
Textureget (const nkMemory::StringView &name)
 
TexturegetByIndex (unsigned int id)
 
void rename (const nkMemory::StringView &currentName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 
void setActiveRenderTarget (Texture *target)
 
void setActiveDepthTarget (Texture *target)
 
TexturegetActiveRenderTarget () const
 
TexturegetDepthTarget () const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ~TextureManager()

nkGraphics::TextureManager::~TextureManager ( )

Destructor.

Member Function Documentation

◆ createOrRetrieve()

Texture* nkGraphics::TextureManager::createOrRetrieve ( const nkMemory::StringView name)

Creates if unavailable, or retrieves if available, a texture.

Parameters
nameThe name of the texture to retrieve.
Returns
The texture requested, possibly freshly created. The manager owns the memory returned, external code should never delete it. See erase().

◆ get()

Texture* nkGraphics::TextureManager::get ( const nkMemory::StringView name)

Retrieves a texture.

Parameters
nameThe name of the texture to retrieve.
Returns
The texture requested if available, nullptr else.

◆ getByIndex()

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.

Parameters
idThe index of the texture to retrieve.
Returns
The texture linked if available, nullptr else.

◆ rename()

void nkGraphics::TextureManager::rename ( const nkMemory::StringView currentName,
const nkMemory::StringView newName 
)

Renames a texture.

Parameters
currentNameThe name of the texture to rename.
newNameThe name to reassign to the texture.

◆ erase()

void nkGraphics::TextureManager::erase ( const nkMemory::StringView name)

Erases and frees a texture.

Parameters
nameThe name of the texture to erase.

◆ setActiveRenderTarget()

void nkGraphics::TextureManager::setActiveRenderTarget ( Texture target)

Sets the active render target. Used during rendering to feed data to the shaders, for instance.

Parameters
targetThe target to flag as active.

◆ setActiveDepthTarget()

void nkGraphics::TextureManager::setActiveDepthTarget ( Texture target)

Sets the active depth render target. Used during rendering to feed data to the shaders, for instance.

Parameters
targetThe target to flag as active.

◆ getActiveRenderTarget()

Texture* nkGraphics::TextureManager::getActiveRenderTarget ( ) const
Returns
The active render target.

◆ getDepthTarget()

Texture* nkGraphics::TextureManager::getDepthTarget ( ) const
Returns
the active depth target.

The documentation for this class was generated from the following file: