Nameless Engine
Loading...
Searching...
No Matches
ne::TextureHandle Class Reference

#include <TextureHandle.h>

Public Member Functions

 TextureHandle (const TextureHandle &)=delete
 
TextureHandleoperator= (const TextureHandle &)=delete
 
 TextureHandle (TextureHandle &&)=delete
 
TextureHandleoperator= (TextureHandle &&)=delete
 
GpuResourcegetResource ()
 
std::string getPathToResourceRelativeRes ()
 
 ~TextureHandle ()
 

Private Member Functions

 TextureHandle (TextureManager *pTextureManager, const std::string &sPathToResourceRelativeRes, GpuResource *pTexture)
 

Private Attributes

const std::string sPathToResourceRelativeRes
 
TextureManager *const pTextureManager = nullptr
 
GpuResource *const pTexture = nullptr
 

Friends

class TextureManager
 

Detailed Description

RAII-style object that tells the manager to not release the texture from the memory while it's being used. A texture resource will be released from the memory when no texture handle that references the same resource path will exist.

Constructor & Destructor Documentation

◆ ~TextureHandle()

ne::TextureHandle::~TextureHandle ( )

Notifies manager about handle no longer referencing the texture.

◆ TextureHandle()

ne::TextureHandle::TextureHandle ( TextureManager pTextureManager,
const std::string &  sPathToResourceRelativeRes,
GpuResource pTexture 
)
private

Creates a new texture handle that references a specific texture resource.

Parameters
pTextureManagerTexture manager that created this handle. It will be notified when the texture handle is being destroyed.
sPathToResourceRelativeResPath to the texture (file/directory) relative to res directory that this texture handle references.
pTextureTexture resource that this handle references.

Member Function Documentation

◆ getPathToResourceRelativeRes()

std::string ne::TextureHandle::getPathToResourceRelativeRes ( )

Path to texture (file/directory) relative to res directory.

Returns
Path relative res directory.

◆ getResource()

GpuResource * ne::TextureHandle::getResource ( )

Returns the underlying GPU resource.

Returns
GPU resource.

Member Data Documentation

◆ pTexture

GpuResource* const ne::TextureHandle::pTexture = nullptr
private

Do not delete (free) this pointer. Texture resource that this handle references.

◆ pTextureManager

TextureManager* const ne::TextureHandle::pTextureManager = nullptr
private

Do not delete (free) this pointer. Texture manager that created this object.

◆ sPathToResourceRelativeRes

const std::string ne::TextureHandle::sPathToResourceRelativeRes
private

Path to texture (file/directory) relative to res directory.

Remarks
Used in texture manager to determine which texture resource this handle references.

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