Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::Assets Class Reference

Asset management class for textures, meshes, fonts, and shaders. More...

#include <Assets.h>

Public Member Functions

void SetRenderer (IRenderer *pRenderer)
 Sets the renderer and loads engine assets.
 
TextureLoadTexture (const std::string &pPath, const std::string &pName, TextureFilter pTexFilter=TextureFilter::LINEAR, bool generateMipMaps=true)
 Loads a texture from file.
 
std::vector< Texture * > BulkLoadTexture (const std::string &pPath, int pLastIndex, const std::string &pFileName, const std::string &pName, TextureFilter pTexFilter=TextureFilter::LINEAR, bool pMipMap=true)
 Loads multiple textures in bulk.
 
MeshLoadMesh (const std::string &pPath, const std::string &pName, std::vector< Texture * > pTextures={}, bool pTesselate=false)
 Loads a mesh with textures.
 
MeshLoadMesh (const std::string &pPath, const std::string &pName, const std::string &pTexture, bool pTesselate=false)
 Loads a mesh with a single texture.
 
MeshLoadMesh (const std::string &pPath, const std::string &pName, bool pTesselate)
 Loads a mesh.
 
MeshLoadMesh (const std::string &pPath, const std::string &pName, ShaderProgram *pShader, std::vector< Texture * > pTextures, bool pTesselate=false)
 Loads a mesh with a shader and textures.
 
MeshLoadMesh (const std::string &pPath, const std::string &pName, ShaderProgram *pShader, bool pTesselate=false)
 Loads a mesh with a shader.
 
FontLoadFont (const std::string &pPath, const std::string &pName, GLuint pFontSize=128)
 Loads a font from file.
 
ShaderLoadShader (const std::string &pPath, ShaderType pType)
 Loads a shader from file.
 
TextureGetTexture (const std::string &pName)
 Gets a loaded texture by name.
 
std::vector< Texture * > BulkGetTexture (const std::string &pName, int pLastIndex)
 Gets multiple textures by name pattern.
 
MeshGetMesh (const std::string &pName, bool pTesselate=false)
 Gets a loaded mesh by name.
 
FontGetFont (const std::string &pName)
 Gets a loaded font by name.
 
ShaderGetShader (const std::string &pName, ShaderType pType)
 Gets a loaded shader by name and type.
 
void ClearAssets ()
 Clears all loaded assets.
 

Static Public Member Functions

static AssetsGet ()
 Gets the singleton instance of Assets.
 

Detailed Description

Asset management class for textures, meshes, fonts, and shaders.

Handles loading, storing, and retrieving engine assets.

Member Function Documentation

◆ BulkGetTexture()

std::vector< Texture * > Assets::BulkGetTexture ( const std::string & pName,
int pLastIndex )

Gets multiple textures by name pattern.

Parameters
pNameName pattern
pLastIndexLast index
Returns
Vector of Texture pointers

◆ BulkLoadTexture()

std::vector< Texture * > Assets::BulkLoadTexture ( const std::string & pPath,
int pLastIndex,
const std::string & pFileName,
const std::string & pName,
TextureFilter pTexFilter = TextureFilter::LINEAR,
bool pMipMap = true )

Loads multiple textures in bulk.

Parameters
pPathPath to textures
pLastIndexLast index for bulk loading
pFileNameFile name pattern
pNameName pattern for textures
pTexFilterTexture filtering mode
pMipMapWhether to generate mipmaps
Returns
Vector of loaded Texture pointers

◆ Get()

Assets & Assets::Get ( )
static

Gets the singleton instance of Assets.

Returns
Reference to Assets instance

◆ GetFont()

Font * Assets::GetFont ( const std::string & pName)

Gets a loaded font by name.

Parameters
pNameName of the font
Returns
Pointer to Font

◆ GetMesh()

Mesh * Assets::GetMesh ( const std::string & pName,
bool pTesselate = false )

Gets a loaded mesh by name.

Parameters
pNameName of the mesh
pTesselateWhether to get tesselated version
Returns
Pointer to Mesh

◆ GetShader()

Shader * Assets::GetShader ( const std::string & pName,
ShaderType pType )

Gets a loaded shader by name and type.

Parameters
pNameName of the shader
pTypeShader type
Returns
Pointer to Shader

◆ GetTexture()

Texture * Assets::GetTexture ( const std::string & pName)

Gets a loaded texture by name.

Parameters
pNameName of the texture
Returns
Pointer to Texture

◆ LoadFont()

Font * Assets::LoadFont ( const std::string & pPath,
const std::string & pName,
GLuint pFontSize = 128 )

Loads a font from file.

Parameters
pPathPath to font file
pNameName to store the font as
pFontSizeFont size
Returns
Pointer to loaded Font

◆ LoadMesh() [1/5]

Mesh * Assets::LoadMesh ( const std::string & pPath,
const std::string & pName,
bool pTesselate )

Loads a mesh.

Parameters
pPathPath to mesh file
pNameName to store the mesh as
pTesselateWhether to tesselate the mesh
Returns
Pointer to loaded Mesh

◆ LoadMesh() [2/5]

Mesh * Assets::LoadMesh ( const std::string & pPath,
const std::string & pName,
const std::string & pTexture,
bool pTesselate = false )

Loads a mesh with a single texture.

Parameters
pPathPath to mesh file
pNameName to store the mesh as
pTextureName of texture to apply
pTesselateWhether to tesselate the mesh
Returns
Pointer to loaded Mesh

◆ LoadMesh() [3/5]

Mesh * Assets::LoadMesh ( const std::string & pPath,
const std::string & pName,
ShaderProgram * pShader,
bool pTesselate = false )

Loads a mesh with a shader.

Parameters
pPathPath to mesh file
pNameName to store the mesh as
pShaderShader program to use
pTesselateWhether to tesselate the mesh
Returns
Pointer to loaded Mesh

◆ LoadMesh() [4/5]

Mesh * Assets::LoadMesh ( const std::string & pPath,
const std::string & pName,
ShaderProgram * pShader,
std::vector< Texture * > pTextures,
bool pTesselate = false )

Loads a mesh with a shader and textures.

Parameters
pPathPath to mesh file
pNameName to store the mesh as
pShaderShader program to use
pTexturesTextures to apply
pTesselateWhether to tesselate the mesh
Returns
Pointer to loaded Mesh

◆ LoadMesh() [5/5]

Mesh * Assets::LoadMesh ( const std::string & pPath,
const std::string & pName,
std::vector< Texture * > pTextures = {},
bool pTesselate = false )

Loads a mesh with textures.

Parameters
pPathPath to mesh file
pNameName to store the mesh as
pTexturesTextures to apply
pTesselateWhether to tesselate the mesh
Returns
Pointer to loaded Mesh

◆ LoadShader()

Shader * Assets::LoadShader ( const std::string & pPath,
ShaderType pType )

Loads a shader from file.

Parameters
pPathPath to shader file
pTypeShader type
Returns
Pointer to loaded Shader

◆ LoadTexture()

Texture * Assets::LoadTexture ( const std::string & pPath,
const std::string & pName,
TextureFilter pTexFilter = TextureFilter::LINEAR,
bool generateMipMaps = true )

Loads a texture from file.

Parameters
pPathPath to texture file
pNameName to store the texture as
pTexFilterTexture filtering mode
generateMipMapsWhether to generate mipmaps
Returns
Pointer to loaded Texture

◆ SetRenderer()

void clt::Assets::SetRenderer ( IRenderer * pRenderer)
inline

Sets the renderer and loads engine assets.

Parameters
pRendererRenderer to use

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