utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::RessourceProvider Class Reference

The RessourceProvider class is responsible for managing and loading various resources such as fonts, materials, and textures in a graphics application. More...

#include <headers/utility/ressource_provider.hpp>

Inheritance diagram for utility::RessourceProvider:
Collaboration diagram for utility::RessourceProvider:

Public Types

enum class  ShaderType { TEXT_SHADER , MESH_SHADER }
 Enumeration for different shader types that can be associated with materials. More...
 

Public Member Functions

 RessourceProvider (SystemIO &systemInterface, const std::string &basePath="")
 Constructs a RessourceProvider object with a reference to a SystemIO instance.
 
 ~RessourceProvider ()=default
 Destructs the RessourceProvider object.
 
const std::map< uint32_t, std::shared_ptr< graphic::Material > > & getMaterials () const
 Retrieves a map of loaded materials.
 
const std::map< uint32_t, std::shared_ptr< graphic::Texture > > & getTextures () const
 Retrieves a map of loaded textures.
 
const std::map< uint32_t, std::shared_ptr< graphic::Model > > & getModels () const
 Retrieves a map of loaded models.
 
const std::map< uint32_t, std::shared_ptr< graphic::Shader > > & getShaders () const
 Retrieves a map of loaded shaders.
 
const std::map< uint32_t, std::shared_ptr< graphic::CodePoints > > & getCodePoints () const
 Retrieves a map of loaded code points resources.
 
uint64_t version () const noexcept
 Retrieves a monotonic counter bumped on every mutation of the provider's resource maps.
 
uint32_t getShaderID (const std::string &shaderName) const
 Retrieves the unique shader ID associated with a given shader name.
 
uint32_t getMaterialID (const std::string &materialName)
 Retrieves the unique material ID associated with a given material name.
 
uint32_t getDefaultMaterialID ()
 Retrieves the unique ID of the default material.
 
uint32_t getMeshMaterialID ()
 Retrieves the unique ID of the mesh material.
 
std::shared_ptr< graphic::FontloadFont (const std::string &path)
 Loads a font resource from a specified file path.
 
std::shared_ptr< graphic::FontloadFontFromAsset (std::shared_ptr< utility::File > fontAsset)
 Loads a font resource from a specified asset.
 
std::shared_ptr< graphic::FontloadFontFamilyFromAssets (const std::vector< std::shared_ptr< utility::File > > &fontAssets)
 Loads a font family resource from a vector of font assets.
 
std::shared_ptr< graphic::MaterialloadMaterial (const std::string &path, ShaderType shaderType)
 Loads a material resource from a specified file path.
 
std::shared_ptr< graphic::MaterialloadMaterialFromAsset (ShaderType shaderType, std::shared_ptr< utility::File > materialAsset)
 Loads a material resource from a specified asset.
 
std::shared_ptr< graphic::TextureloadTexture (const std::string &path)
 Loads a texture resource from a specified file path.
 
std::shared_ptr< graphic::TextureloadTextureFromAsset (std::shared_ptr< utility::File > textureAsset)
 Loads a texture resource from a specified asset.
 
std::shared_ptr< graphic::MaterialloadImageMaterial (const std::string &path)
 Loads an image texture and wraps it in a material bound to the default shader.
 
std::shared_ptr< graphic::ModelloadModel (const std::string &path, const utility::graphic::PoseF &pose=utility::graphic::PoseF(), const std::string &material="default_material")
 Loads a model resource from a specified file path.
 
std::shared_ptr< graphic::ModelloadModelFromAsset (std::shared_ptr< utility::File > modelAsset, const utility::graphic::PoseF &pose=utility::graphic::PoseF(), const std::string &material="default_material")
 Loads a model resource from a specified asset.
 
std::shared_ptr< graphic::ModelloadModelFromAsset (std::shared_ptr< utility::File > modelAsset, graphic::Model::ModelType type, const utility::graphic::PoseF &pose=utility::graphic::PoseF(), const std::string &material="default_material")
 Loads a model resource from a specified file path and model type.
 
std::shared_ptr< graphic::ModelloadObj (const std::string &path, const utility::graphic::PoseF &pose=utility::graphic::PoseF(), const std::string &material="default_material")
 Loads an OBJ model resource from a specified file path.
 
std::shared_ptr< graphic::ModelloadObjFromAsset (std::shared_ptr< utility::File > modelAsset, const utility::graphic::PoseF &pose=utility::graphic::PoseF(), const std::string &material="default_material")
 Loads an OBJ model resource from a specified asset.
 
std::shared_ptr< graphic::ShaderloadShader (const std::string &vertexPath, const std::string &fragmentPath)
 Loads a shader resource from specified vertex and fragment shader file paths.
 
std::shared_ptr< graphic::ShaderloadShaderFromAssets (std::shared_ptr< utility::File > vertexAsset, std::shared_ptr< utility::File > fragmentAsset)
 Loads a shader resource from specified vertex and fragment shader assets.
 
std::shared_ptr< graphic::CodePointsloadCodePoints (const std::string &path)
 Loads a code points resource from a specified file path.
 
std::shared_ptr< graphic::CodePointsloadCodePointsFromAsset (std::shared_ptr< utility::File > codePointsAsset)
 Loads a code points resource from a specified asset.
 
std::unique_ptr< sound::AudioSourceloadAudioSource (const std::string &path)
 Loads an audio source resource from a specified file path.
 
std::unique_ptr< sound::AudioSourceloadAudioSourceFromAsset (std::shared_ptr< utility::File > audioAsset)
 Loads an audio source resource from a specified asset.
 

Protected Member Functions

std::string buildShaderPath (const std::string &vertexPath, const std::string &fragmentPath) const
 Builds a unique shader name based on the vertex and fragment shader file paths.
 
void onFontAtlasCreated (const std::string &name, std::shared_ptr< graphic::Texture > atlas)
 Registers a font texture atlas produced by a Font instance.
 
void registerShader (uint32_t id, const std::string &path, const std::string &vertexPath, std::shared_ptr< graphic::Shader > shader)
 Registers a loaded shader in the internal resource maps and the shader-only lookup index used by getShaderID().
 
uint32_t getNextID ()
 Retrieves the next unique ID for a resource.
 
void touch () noexcept
 Records a mutation of the provider's resource maps.
 
- Protected Member Functions inherited from utility::logging::Loggable< RessourceProvider, utility::logging::DefaultLogger >
 Loggable (void)
 Construct a Loggable with the specified LoggerType.
 
 Loggable (Loggable &&other) noexcept
 Move constructor for Loggable.
 
Loggableoperator= (Loggable &&other) noexcept
 Move assignment operator for Loggable.
 
LoggerType & getLogger (void)
 Get the internal logger.
 
LoggerType & getLogger (void) const
 Get the internal logger.
 
virtual ~Loggable (void)=default
 Virtual destructor for proper cleanup.
 

Protected Attributes

uint32_t _currentID = 1
 Internal counter for generating unique IDs for resources.
 
uint64_t _version = 0
 Monotonic counter bumped on every mutation of the resource maps.
 
std::map< uint32_t, std::shared_ptr< graphic::Font > > _fonts
 Internal maps to store loaded fonts for efficient retrieval.
 
std::map< uint32_t, std::shared_ptr< graphic::Material > > _materials
 Internal map to store loaded materials for efficient retrieval.
 
std::map< uint32_t, std::shared_ptr< graphic::Texture > > _textures
 Internal map to store loaded textures for efficient retrieval.
 
std::map< uint32_t, std::shared_ptr< graphic::Model > > _models
 Internal map to store loaded models for efficient retrieval.
 
std::map< uint32_t, std::shared_ptr< graphic::Shader > > _shaders
 Internal map to store loaded shaders for efficient retrieval.
 
std::unordered_map< std::string, uint32_t > _shaderIDs
 Shader-only index mapping a shader name to its id.
 
std::map< uint32_t, std::shared_ptr< graphic::CodePoints > > _codePoints
 Internal map to store loaded code points resources for efficient retrieval.
 
std::map< uint32_t, std::shared_ptr< sound::AudioBuffer > > _audioSources
 Internal map to store loaded audio buffers for efficient retrieval.
 
std::unordered_map< std::string, uint32_t > _elementsIDs
 Internal map to store resource IDs for efficient lookup based on file paths.
 
SystemIO_systemInterface
 Reference to the SystemIO instance used for loading assets from file paths.
 
std::string _basePath
 An optional base path to prepend to resource paths when loading resources.
 
utility::sound::AudioManager _audioManager
 Internal audio manager instance for managing audio operations.
 

Detailed Description

The RessourceProvider class is responsible for managing and loading various resources such as fonts, materials, and textures in a graphics application.

The RessourceProvider provides methods to load resources from file paths or from asset objects, and it maintains internal maps to store loaded resources for efficient retrieval. It supports loading fonts, materials, and textures, and it can handle different shader types for materials.

Definition at line 36 of file ressource_provider.hpp.

Member Enumeration Documentation

◆ ShaderType

Enumeration for different shader types that can be associated with materials.

This enum defines the types of shaders that can be used when loading materials. It currently includes TEXT_SHADER for text rendering and MESH_SHADER for mesh rendering, allowing for different visual effects based on the shader type used in the material.

Definition at line 50 of file ressource_provider.hpp.

Constructor & Destructor Documentation

◆ RessourceProvider()

utility::RessourceProvider::RessourceProvider ( SystemIO systemInterface,
const std::string &  basePath = "" 
)

Constructs a RessourceProvider object with a reference to a SystemIO instance.

Parameters
systemInterfaceA reference to the SystemIO instance used for loading assets from file paths. The RessourceProvider relies on the SystemIO interface to load resources from the filesystem, and this constructor initializes the RessourceProvider with the provided SystemIO instance for asset loading operations.
basePathAn optional base path to prepend to resource paths when loading resources. This can be used to specify a common directory for all resources, allowing for more flexible resource management and organization.

Member Function Documentation

◆ buildShaderPath()

std::string utility::RessourceProvider::buildShaderPath ( const std::string &  vertexPath,
const std::string &  fragmentPath 
) const
protected

Builds a unique shader name based on the vertex and fragment shader file paths.

This method constructs a unique name for a shader by combining the vertex and fragment shader file paths. The resulting name can be used as a key in the internal map to store and retrieve shader resources efficiently. The method ensures that shaders with the same vertex and fragment paths will have the same name, allowing for proper caching and reuse of shader resources.

Parameters
vertexPathThe file path to the vertex shader resource.
fragmentPathThe file path to the fragment shader resource.
Returns
A string representing the unique shader name constructed from the vertex and fragment shader file paths.

◆ getCodePoints()

const std::map< uint32_t, std::shared_ptr< graphic::CodePoints > > & utility::RessourceProvider::getCodePoints ( ) const

Retrieves a map of loaded code points resources.

Returns
A const reference to a map where the keys are code points IDs (uint32_t) and the values are shared pointers to the corresponding CodePoints objects.
Warning
The returned reference is valid only until the next mutating call on this provider (any load* method).

◆ getDefaultMaterialID()

uint32_t utility::RessourceProvider::getDefaultMaterialID ( )

Retrieves the unique ID of the default material.

If the default material is not found, then it creates a new default material with the default shader and returns its ID. The default material is used as a fallback when a specific material is not found for a resource, ensuring that the application can still render objects even if their intended materials are missing or misconfigured.

Returns
The unique ID of the default material.

◆ getMaterialID()

uint32_t utility::RessourceProvider::getMaterialID ( const std::string &  materialName)

Retrieves the unique material ID associated with a given material name.

Parameters
materialNameThe name of the material for which to retrieve the ID.
Returns
The unique material ID associated with the given material name, or 0 if the material name is not found.

◆ getMaterials()

const std::map< uint32_t, std::shared_ptr< graphic::Material > > & utility::RessourceProvider::getMaterials ( ) const

Retrieves a map of loaded materials.

Returns
A const reference to a map where the keys are material IDs (uint32_t) and the values are shared pointers to the corresponding Material objects.
Warning
The returned reference is valid only until the next mutating call on this provider (any load* method).

◆ getMeshMaterialID()

uint32_t utility::RessourceProvider::getMeshMaterialID ( )

Retrieves the unique ID of the mesh material.

Returns
The unique ID of the mesh material.

◆ getModels()

const std::map< uint32_t, std::shared_ptr< graphic::Model > > & utility::RessourceProvider::getModels ( ) const

Retrieves a map of loaded models.

Returns
A const reference to a map where the keys are model IDs (uint32_t) and the values are shared pointers to the corresponding Model objects.
Warning
The returned reference is valid only until the next mutating call on this provider (any load* method).

◆ getNextID()

uint32_t utility::RessourceProvider::getNextID ( )
protected

Retrieves the next unique ID for a resource.

This method increments the internal nextID counter and returns the next unique ID for a resource. It is used internally to assign unique IDs to loaded resources such as fonts, materials, textures, and models. The returned ID can be used as a key in the internal maps to store and retrieve resources efficiently.

Note
Do not modify the internal nextID variable directly. Use this method to ensure that unique IDs are generated correctly and consistently for all resources.
Returns
A uint32_t representing the next unique ID for a resource. Each call to this method will return a different ID, ensuring that all resources have unique identifiers.

◆ getShaderID()

uint32_t utility::RessourceProvider::getShaderID ( const std::string &  shaderName) const

Retrieves the unique shader ID associated with a given shader name.

This method looks up the shader name in an internal map and returns the corresponding shader ID if found. If the shader name is not found, it returns 0, indicating that the shader does not exist in the resource provider.

Parameters
shaderNameThe name of the shader for which to retrieve the ID.
Returns
The unique shader ID associated with the given shader name, or 0 if the shader name is not found.

◆ getShaders()

const std::map< uint32_t, std::shared_ptr< graphic::Shader > > & utility::RessourceProvider::getShaders ( ) const

Retrieves a map of loaded shaders.

Returns
A const reference to a map where the keys are shader IDs (uint32_t) and the values are shared pointers to the corresponding Shader objects.
Warning
The returned reference is valid only until the next mutating call on this provider (any load* method).

◆ getTextures()

const std::map< uint32_t, std::shared_ptr< graphic::Texture > > & utility::RessourceProvider::getTextures ( ) const

Retrieves a map of loaded textures.

Returns
A const reference to a map where the keys are texture IDs (uint32_t) and the values are shared pointers to the corresponding Texture objects.
Warning
The returned reference is valid only until the next mutating call on this provider (any load* method).

◆ loadAudioSource()

std::unique_ptr< sound::AudioSource > utility::RessourceProvider::loadAudioSource ( const std::string &  path)

Loads an audio source resource from a specified file path.

Parameters
pathThe file path to the audio source resource to be loaded.
Returns
A unique pointer to the loaded AudioSource object.

◆ loadAudioSourceFromAsset()

std::unique_ptr< sound::AudioSource > utility::RessourceProvider::loadAudioSourceFromAsset ( std::shared_ptr< utility::File audioAsset)

Loads an audio source resource from a specified asset.

Parameters
audioAssetA shared pointer to the File object containing the audio source data to be loaded.
Returns
A unique pointer to the loaded AudioSource object.

◆ loadCodePoints()

std::shared_ptr< graphic::CodePoints > utility::RessourceProvider::loadCodePoints ( const std::string &  path)

Loads a code points resource from a specified file path.

Parameters
pathThe file path to the .codepoints file to be loaded.
Returns
A shared pointer to the loaded CodePoints object.

◆ loadCodePointsFromAsset()

std::shared_ptr< graphic::CodePoints > utility::RessourceProvider::loadCodePointsFromAsset ( std::shared_ptr< utility::File codePointsAsset)

Loads a code points resource from a specified asset.

Parameters
codePointsAssetA shared pointer to the File object containing the .codepoints data to be loaded.
Returns
A shared pointer to the loaded CodePoints object.

◆ loadFont()

std::shared_ptr< graphic::Font > utility::RessourceProvider::loadFont ( const std::string &  path)

Loads a font resource from a specified file path.

Parameters
pathThe file path to the font resource to be loaded.
Returns
A shared pointer to the loaded Font object.

◆ loadFontFamilyFromAssets()

std::shared_ptr< graphic::Font > utility::RessourceProvider::loadFontFamilyFromAssets ( const std::vector< std::shared_ptr< utility::File > > &  fontAssets)

Loads a font family resource from a vector of font assets.

Parameters
fontAssetsA vector of shared pointers to File objects containing the font data for the font family to be loaded.
Returns
A shared pointer to the loaded Font object representing the font family.

◆ loadFontFromAsset()

std::shared_ptr< graphic::Font > utility::RessourceProvider::loadFontFromAsset ( std::shared_ptr< utility::File fontAsset)

Loads a font resource from a specified asset.

Parameters
fontAssetA shared pointer to the File object containing the font data to be loaded.
Returns
A shared pointer to the loaded Font object.

◆ loadImageMaterial()

std::shared_ptr< graphic::Material > utility::RessourceProvider::loadImageMaterial ( const std::string &  path)

Loads an image texture and wraps it in a material bound to the default shader.

This method loads the image at the given path as a texture and creates a material that uses the "default" shader (which samples the albedo texture at binding 1) with the loaded image texture. The material is registered under a deterministic name (image_<path>) so that getMaterialID("image_<path>") resolves and the material can be used with addMesh.

Parameters
pathThe file path to the image resource to be loaded.
Returns
A shared pointer to the loaded Material object, or nullptr if the image texture could not be loaded.

◆ loadMaterial()

std::shared_ptr< graphic::Material > utility::RessourceProvider::loadMaterial ( const std::string &  path,
ShaderType  shaderType 
)

Loads a material resource from a specified file path.

Parameters
pathThe file path to the material resource to be loaded.
shaderTypeThe type of shader to be associated with the loaded material.
Returns
A shared pointer to the loaded Material object.

◆ loadMaterialFromAsset()

std::shared_ptr< graphic::Material > utility::RessourceProvider::loadMaterialFromAsset ( ShaderType  shaderType,
std::shared_ptr< utility::File materialAsset 
)

Loads a material resource from a specified asset.

Parameters
shaderTypeThe type of shader to be associated with the loaded material.
materialAssetA shared pointer to the File object containing the material data to be loaded.
Returns
A shared pointer to the loaded Material object.

◆ loadModel()

std::shared_ptr< graphic::Model > utility::RessourceProvider::loadModel ( const std::string &  path,
const utility::graphic::PoseF pose = utility::graphic::PoseF(),
const std::string &  material = "default_material" 
)

Loads a model resource from a specified file path.

Parameters
pathThe file path to the model resource to be loaded.
poseThe initial position and orientation for the model.
materialThe name of the material to be associated with the loaded model. If not specified, the default material will be used.
Returns
A shared pointer to the loaded Model object.

◆ loadModelFromAsset() [1/2]

std::shared_ptr< graphic::Model > utility::RessourceProvider::loadModelFromAsset ( std::shared_ptr< utility::File modelAsset,
const utility::graphic::PoseF pose = utility::graphic::PoseF(),
const std::string &  material = "default_material" 
)

Loads a model resource from a specified asset.

Parameters
modelAssetA shared pointer to the File object containing the model data to be loaded.
poseThe initial position and orientation for the model.
materialThe name of the material to be associated with the loaded model. If not specified, the default material will be used.
Returns
A shared pointer to the loaded Model object.

◆ loadModelFromAsset() [2/2]

std::shared_ptr< graphic::Model > utility::RessourceProvider::loadModelFromAsset ( std::shared_ptr< utility::File modelAsset,
graphic::Model::ModelType  type,
const utility::graphic::PoseF pose = utility::graphic::PoseF(),
const std::string &  material = "default_material" 
)

Loads a model resource from a specified file path and model type.

Parameters
modelAssetA shared pointer to the File object containing the model data to be loaded.
typeThe type of the model (e.g., OBJ, FBX, GLTF) to be loaded.
poseThe initial position and orientation for the model.
materialThe name of the material to be associated with the loaded model. If not specified, the default material will be used.
Returns
A shared pointer to the loaded Model object.

◆ loadObj()

std::shared_ptr< graphic::Model > utility::RessourceProvider::loadObj ( const std::string &  path,
const utility::graphic::PoseF pose = utility::graphic::PoseF(),
const std::string &  material = "default_material" 
)

Loads an OBJ model resource from a specified file path.

Parameters
pathThe file path to the OBJ model resource to be loaded.
poseThe initial position and orientation for the model.
materialThe name of the material to be associated with the loaded OBJ model. If not specified, the default material will be used.
Returns
A shared pointer to the loaded Model object representing the OBJ model.

◆ loadObjFromAsset()

std::shared_ptr< graphic::Model > utility::RessourceProvider::loadObjFromAsset ( std::shared_ptr< utility::File modelAsset,
const utility::graphic::PoseF pose = utility::graphic::PoseF(),
const std::string &  material = "default_material" 
)

Loads an OBJ model resource from a specified asset.

Parameters
modelAssetA shared pointer to the File object containing the OBJ model data to be loaded.
poseThe initial position and orientation for the model.
materialThe name of the material to be associated with the loaded OBJ model. If not specified, the default material will be used.
Returns
A shared pointer to the loaded Model object representing the OBJ model.

◆ loadShader()

std::shared_ptr< graphic::Shader > utility::RessourceProvider::loadShader ( const std::string &  vertexPath,
const std::string &  fragmentPath 
)

Loads a shader resource from specified vertex and fragment shader file paths.

Parameters
vertexPathThe file path to the vertex shader resource to be loaded.
fragmentPathThe file path to the fragment shader resource to be loaded.
Returns
A shared pointer to the loaded Shader object.

◆ loadShaderFromAssets()

std::shared_ptr< graphic::Shader > utility::RessourceProvider::loadShaderFromAssets ( std::shared_ptr< utility::File vertexAsset,
std::shared_ptr< utility::File fragmentAsset 
)

Loads a shader resource from specified vertex and fragment shader assets.

Parameters
vertexAssetA shared pointer to the File object containing the vertex shader data to be loaded.
fragmentAssetA shared pointer to the File object containing the fragment shader data to be loaded.
Returns
A shared pointer to the loaded Shader object.

◆ loadTexture()

std::shared_ptr< graphic::Texture > utility::RessourceProvider::loadTexture ( const std::string &  path)

Loads a texture resource from a specified file path.

Parameters
pathThe file path to the texture resource to be loaded.
Returns
A shared pointer to the loaded Texture object.

◆ loadTextureFromAsset()

std::shared_ptr< graphic::Texture > utility::RessourceProvider::loadTextureFromAsset ( std::shared_ptr< utility::File textureAsset)

Loads a texture resource from a specified asset.

Parameters
textureAssetA shared pointer to the File object containing the texture data to be loaded.
Returns
A shared pointer to the loaded Texture object.
Here is the caller graph for this function:

◆ onFontAtlasCreated()

void utility::RessourceProvider::onFontAtlasCreated ( const std::string &  name,
std::shared_ptr< graphic::Texture atlas 
)
protected

Registers a font texture atlas produced by a Font instance.

Adds the atlas to the texture map, lazily creates the matching TextMaterial when it does not exist yet, and records the atlas on that material. Because the atlas updates the contents of an existing material without allocating a new id, this method calls touch() explicitly so that version() reflects the change.

Parameters
nameThe font face name suffixed with the font size (e.g. "DejaVuSans_16").
atlasThe generated texture atlas.

◆ registerShader()

void utility::RessourceProvider::registerShader ( uint32_t  id,
const std::string &  path,
const std::string &  vertexPath,
std::shared_ptr< graphic::Shader shader 
)
protected

Registers a loaded shader in the internal resource maps and the shader-only lookup index used by getShaderID().

The shader is stored under its unique id, its full shader path and its canonical short name (the vertex shader file name without its extension, e.g. "text" for "text.vs"). The index makes lookups deterministic regardless of container iteration order.

Parameters
idThe unique id assigned to the shader.
pathThe full shader path built by buildShaderPath().
vertexPathThe (resolved) vertex shader file path used to derive the canonical short name.
shaderThe loaded shader to register.

◆ touch()

void utility::RessourceProvider::touch ( )
protectednoexcept

Records a mutation of the provider's resource maps.

Must be called for every change to the resource containers, including in-place content updates that do not allocate a new id (e.g. a font atlas updating an existing TextMaterial).

◆ version()

uint64_t utility::RessourceProvider::version ( ) const
noexcept

Retrieves a monotonic counter bumped on every mutation of the provider's resource maps.

The counter is incremented both when a new resource is registered (new id) and when an existing resource's contents are updated in place without allocating a new id (e.g. a font atlas updating an existing TextMaterial). Consumers can cache the value and skip their whole synchronization work while it is unchanged.

Returns
The current version of the provider's resource maps.

Member Data Documentation

◆ _audioManager

utility::sound::AudioManager utility::RessourceProvider::_audioManager
protected

Internal audio manager instance for managing audio operations.

This member variable holds an instance of the AudioManager that is used for managing audio playback and related operations. It handles the creation and management of audio sources loaded through the resource provider.

Definition at line 661 of file ressource_provider.hpp.

◆ _audioSources

std::map<uint32_t, std::shared_ptr<sound::AudioBuffer> > utility::RessourceProvider::_audioSources
protected

Internal map to store loaded audio buffers for efficient retrieval.

Definition at line 618 of file ressource_provider.hpp.

◆ _basePath

std::string utility::RessourceProvider::_basePath
protected

An optional base path to prepend to resource paths when loading resources.

This member variable holds a base path that can be used to specify a common directory for all resources. When loading resources, the RessourceProvider can prepend this base path to the provided resource paths, allowing for more flexible resource management and organization. This is particularly useful when all resources are stored in a specific directory, as it eliminates the need to provide the full path for each resource when loading them.

Definition at line 651 of file ressource_provider.hpp.

◆ _codePoints

std::map<uint32_t, std::shared_ptr<graphic::CodePoints> > utility::RessourceProvider::_codePoints
protected

Internal map to store loaded code points resources for efficient retrieval.

Definition at line 612 of file ressource_provider.hpp.

◆ _currentID

uint32_t utility::RessourceProvider::_currentID = 1
protected

Internal counter for generating unique IDs for resources.

Note
Do not modify this variable directly. Use the getNextID() method to retrieve the next unique ID for a resource.

Definition at line 561 of file ressource_provider.hpp.

◆ _elementsIDs

std::unordered_map<std::string, uint32_t> utility::RessourceProvider::_elementsIDs
protected

Internal map to store resource IDs for efficient lookup based on file paths.

Definition at line 624 of file ressource_provider.hpp.

◆ _fonts

std::map<uint32_t, std::shared_ptr<graphic::Font> > utility::RessourceProvider::_fonts
protected

Internal maps to store loaded fonts for efficient retrieval.

Definition at line 575 of file ressource_provider.hpp.

◆ _materials

std::map<uint32_t, std::shared_ptr<graphic::Material> > utility::RessourceProvider::_materials
protected

Internal map to store loaded materials for efficient retrieval.

Definition at line 581 of file ressource_provider.hpp.

◆ _models

std::map<uint32_t, std::shared_ptr<graphic::Model> > utility::RessourceProvider::_models
protected

Internal map to store loaded models for efficient retrieval.

Definition at line 591 of file ressource_provider.hpp.

◆ _shaderIDs

std::unordered_map<std::string, uint32_t> utility::RessourceProvider::_shaderIDs
protected

Shader-only index mapping a shader name to its id.

Keys are the full shader path (e.g. "text.vs_with_text.fs") and the canonical short name (e.g. "text"). Keeping this index separate from _elementsIDs makes getShaderID() an O(1) average lookup and keeps non-shader entries out of shader resolution.

Definition at line 606 of file ressource_provider.hpp.

◆ _shaders

std::map<uint32_t, std::shared_ptr<graphic::Shader> > utility::RessourceProvider::_shaders
protected

Internal map to store loaded shaders for efficient retrieval.

Definition at line 596 of file ressource_provider.hpp.

◆ _systemInterface

SystemIO& utility::RessourceProvider::_systemInterface
protected

Reference to the SystemIO instance used for loading assets from file paths.

The RessourceProvider relies on the SystemIO interface to load resources from the filesystem, and this member variable holds a reference to the SystemIO instance that is used for asset loading operations. It allows the RessourceProvider to access the necessary functionality of the SystemIO interface to read files and load resources based on file paths provided in the loading methods.

Definition at line 637 of file ressource_provider.hpp.

◆ _textures

std::map<uint32_t, std::shared_ptr<graphic::Texture> > utility::RessourceProvider::_textures
protected

Internal map to store loaded textures for efficient retrieval.

Definition at line 586 of file ressource_provider.hpp.

◆ _version

uint64_t utility::RessourceProvider::_version = 0
protected

Monotonic counter bumped on every mutation of the resource maps.

Note
Do not modify this variable directly. Use the touch() method to record a mutation.

Definition at line 570 of file ressource_provider.hpp.


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