|
utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
|
The TextMaterial class is a specialized Material that is designed to work with Font objects for rendering text. More...
#include <headers/utility/graphic/text/text_material.hpp>


Public Member Functions | |
| TextMaterial () | |
| Constructs a TextMaterial object that is synchronized with the provided Font object. | |
| ~TextMaterial ()=default | |
| Destructs the TextMaterial object, releasing any allocated resources. | |
| void | addAtlas (const std::string &name, std::shared_ptr< Texture > atlas) |
| Add a texture atlas to the material with the specified name and Texture object. | |
Public Member Functions inherited from utility::graphic::Material | |
| Material ()=default | |
| Constructs an empty Material. | |
| Material (RessourceProvider &ressourceProvider, const std::string &shaderName, const std::vector< File > &textureAssets) | |
| Constructs a Material object with the specified shader name and texture assets. | |
| virtual | ~Material ()=default |
| Destructs the Material object, releasing any allocated resources. | |
| std::shared_ptr< Texture > | getTexture (const std::string &name) const |
| Retrieves a texture by its name. | |
| std::vector< std::shared_ptr< Texture > > | getTextures () const |
| Retrieves the textures associated with this material. | |
| const std::string & | getShaderName () const |
| Retrieves the shader name associated with this material. | |
| AlphaMode | getAlphaMode (void) const |
| Retrieves the alpha semantics of this material. | |
| float | getAlphaCutoff (void) const |
| Retrieves the alpha cutoff of this material. | |
| uint32_t | getVersion () const |
| Retrieves the version number of the material. | |
Additional Inherited Members | |
Protected Attributes inherited from utility::graphic::Material | |
| std::string | _shaderName |
| The name of the shader associated with this material. | |
| std::map< std::string, std::shared_ptr< Texture > > | _textures |
| A map of texture names to Texture objects associated with this material. | |
| uint32_t | _version = 0 |
| A version number for the material, used for tracking changes and updates. | |
| AlphaMode | _alphaMode = AlphaMode::Opaque |
| The alpha semantics of this material. | |
| float | _alphaCutoff = 0.5f |
| The alpha cutoff, only meaningful for AlphaMode::Mask. | |
The TextMaterial class is a specialized Material that is designed to work with Font objects for rendering text.
The TextMaterial class extends the Material class and includes functionality to synchronize with a Font object. It manages the textures associated with the font's glyph atlases, allowing for efficient rendering of text using the associated shader.
The syncFont method is responsible for updating the material's textures based on the font's processed sizes and paths, ensuring that the correct textures are available for rendering text with the specified font.
Definition at line 29 of file text_material.hpp.
| utility::graphic::TextMaterial::TextMaterial | ( | ) |
Constructs a TextMaterial object that is synchronized with the provided Font object.
This constructor initializes the TextMaterial with a reference to a Font object. The TextMaterial will use this Font to manage its textures and ensure that they are synchronized with the font's glyph atlases.
Definition at line 12 of file text_material.cpp.
| void utility::graphic::TextMaterial::addAtlas | ( | const std::string & | name, |
| std::shared_ptr< Texture > | atlas | ||
| ) |
Add a texture atlas to the material with the specified name and Texture object.
This method allows adding a texture atlas to the material by associating it with a specific name. The texture atlas is represented by a shared pointer to a Texture object, which contains the pixel data for the glyphs in the font. This method is used to manage the textures that are required for rendering text with the associated shader.
| name | The name to associate with the texture atlas. |
| atlas | A shared pointer to the Texture object representing the texture atlas to be added to the material. |
Definition at line 19 of file text_material.cpp.