Hymn to Beauty
C++ 3D Engine
ResourceManager Class Reference

Handles all resources. More...

#include <ResourceManager.hpp>

Public Member Functions

 ResourceManager (Video::Renderer *renderer)
 Constructor. More...
 
 ~ResourceManager ()
 Destructor. More...
 
Geometry::ModelCreateModel (const std::string &name)
 Create a model if it doesn't already exist. More...
 
void FreeModel (Geometry::Model *model)
 Free the reference to the model. More...
 
Video::Texture2DCreateTexture2D (const char *data, int dataLength)
 Create a 2D texture if it doesn't already exist. More...
 
void FreeTexture2D (Video::Texture2D *texture)
 Free the reference to the 2D texture. More...
 
TextureAssetCreateTextureAsset (const std::string &name)
 Create a texture asset if it doesn't already exist. More...
 
void FreeTextureAsset (TextureAsset *textureAsset)
 Free the reference to the texture asset. More...
 
int GetTextureAssetInstanceCount (TextureAsset *textureAsset)
 Get the number of instances of a texture asset. More...
 
ScriptFileCreateScriptFile (const std::string &name)
 Create a script file if it doesn't already exist. More...
 
void FreeScriptFile (ScriptFile *scriptFile)
 Free the reference to the script file. More...
 
TextureAssetGetDefaultAlbedo ()
 Get the default albedo texture. More...
 
TextureAssetGetDefaultNormal ()
 Get the default normal map. More...
 
TextureAssetGetDefaultRoughnessMetallic ()
 Get the default roughness-metallic texture. More...
 

Friends

class Hub
 

Detailed Description

Handles all resources.

Constructor & Destructor Documentation

◆ ResourceManager()

ResourceManager::ResourceManager ( Video::Renderer renderer)
explicit

Constructor.

Parameters
rendererThe renderer.

◆ ~ResourceManager()

ResourceManager::~ResourceManager ( )

Destructor.

Member Function Documentation

◆ CreateModel()

Geometry::Model * ResourceManager::CreateModel ( const std::string &  name)

Create a model if it doesn't already exist.

Parameters
nameName of model.
Returns
The model instance

◆ CreateScriptFile()

ScriptFile * ResourceManager::CreateScriptFile ( const std::string &  name)

Create a script file if it doesn't already exist.

Parameters
nameName of the script file.
Returns
The ScriptFile instance.

◆ CreateTexture2D()

Video::Texture2D * ResourceManager::CreateTexture2D ( const char *  data,
int  dataLength 
)

Create a 2D texture if it doesn't already exist.

Parameters
dataImage file data.
dataLengthLength of the image file data.
Returns
The Texture2D instance

◆ CreateTextureAsset()

TextureAsset * ResourceManager::CreateTextureAsset ( const std::string &  name)

Create a texture asset if it doesn't already exist.

Parameters
nameThe name of the texture asset.
Returns
The TextureAsset instance

◆ FreeModel()

void ResourceManager::FreeModel ( Geometry::Model model)

Free the reference to the model.

Parameters
modelModel to dereference.

◆ FreeScriptFile()

void ResourceManager::FreeScriptFile ( ScriptFile scriptFile)

Free the reference to the script file.

Deletes the instance if no more references exist.

Parameters
scriptFileScriptFile to dereference.

◆ FreeTexture2D()

void ResourceManager::FreeTexture2D ( Video::Texture2D texture)

Free the reference to the 2D texture.

Deletes the instance if no more references exist.

Parameters
textureTexture to dereference.

◆ FreeTextureAsset()

void ResourceManager::FreeTextureAsset ( TextureAsset textureAsset)

Free the reference to the texture asset.

Deletes the instance if no more references exist.

Parameters
textureAssetTextureAsset to dereference.

◆ GetDefaultAlbedo()

TextureAsset * ResourceManager::GetDefaultAlbedo ( )

Get the default albedo texture.

Returns
The default albedo texture.

◆ GetDefaultNormal()

TextureAsset * ResourceManager::GetDefaultNormal ( )

Get the default normal map.

Returns
The default normal map.

◆ GetDefaultRoughnessMetallic()

TextureAsset * ResourceManager::GetDefaultRoughnessMetallic ( )

Get the default roughness-metallic texture.

Returns
The default roughness-metallic texture.

◆ GetTextureAssetInstanceCount()

int ResourceManager::GetTextureAssetInstanceCount ( TextureAsset textureAsset)

Get the number of instances of a texture asset.

Parameters
textureAssetThe texture asset to check.
Returns
How many instances of the texture asset currently exist.

Friends And Related Function Documentation

◆ Hub

friend class Hub
friend

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