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
material.hpp
1/*
2** ETIB PROJECT, 2026
3** utility
4** File description:
5** material
6*/
7
8#pragma once
9
10#include <string>
11#include <map>
12#include <vector>
13
14#include <utility/system_io/file.hpp>
15
16#include <utility/graphic/texture.hpp>
17
18namespace utility
19{
20 class RessourceProvider;
21}
22
23namespace utility::graphic
24{
25
35 enum class AlphaMode {
36 Opaque,
37 Mask,
40 Blend
41 };
42
58 {
59 public:
67 Material() = default;
68
88 Material(RessourceProvider &ressourceProvider,
89 const std::string &shaderName,
90 const std::vector<File> &textureAssets);
91
96 virtual ~Material() = default;
97
109 std::shared_ptr<Texture> getTexture(const std::string &name) const;
110
120 std::vector<std::shared_ptr<Texture>> getTextures() const;
121
133 const std::string &getShaderName() const;
134
143 [[nodiscard]] AlphaMode getAlphaMode(void) const;
144
153 [[nodiscard]] float getAlphaCutoff(void) const;
154
164 uint32_t getVersion() const;
165
166 protected:
170 std::string _shaderName;
171
176 std::map<std::string, std::shared_ptr<Texture>> _textures;
177
182 uint32_t _version = 0;
183
187 AlphaMode _alphaMode = AlphaMode::Opaque;
188
192 float _alphaCutoff = 0.5f;
193 };
194} // namespace utility::graphic
The RessourceProvider class is responsible for managing and loading various resources such as fonts,...
The Material class represents a material that can be used for rendering objects in a graphics applica...
Definition material.hpp:58
std::string _shaderName
The name of the shader associated with this material.
Definition material.hpp:170
Material()=default
Constructs an empty Material.
std::map< std::string, std::shared_ptr< Texture > > _textures
A map of texture names to Texture objects associated with this material.
Definition material.hpp:176
AlphaMode getAlphaMode(void) const
Retrieves the alpha semantics of this material.
Definition material.cpp:57
float _alphaCutoff
The alpha cutoff, only meaningful for AlphaMode::Mask.
Definition material.hpp:192
virtual ~Material()=default
Destructs the Material object, releasing any allocated resources.
const std::string & getShaderName() const
Retrieves the shader name associated with this material.
Definition material.cpp:52
uint32_t _version
A version number for the material, used for tracking changes and updates.
Definition material.hpp:182
std::shared_ptr< Texture > getTexture(const std::string &name) const
Retrieves a texture by its name.
Definition material.cpp:33
std::vector< std::shared_ptr< Texture > > getTextures() const
Retrieves the textures associated with this material.
Definition material.cpp:42
AlphaMode _alphaMode
The alpha semantics of this material.
Definition material.hpp:187
uint32_t getVersion() const
Retrieves the version number of the material.
Definition material.cpp:67
float getAlphaCutoff(void) const
Retrieves the alpha cutoff of this material.
Definition material.cpp:62
The utility namespace contains classes and functions for the utility project.
Definition cache.hpp:34