|
Aeon Engine c550894
AeonGames Open Source Game Engine
|
Represents a surface material with uniform properties and texture samplers. More...
#include <aeongames/Material.hpp>


Public Types | |
| using | UniformValue = std::variant<uint32_t, int32_t, float, Vector2, Vector3, Vector4, Matrix4x4> |
| Variant type holding any supported uniform value. | |
| using | UniformKeyValue = std::tuple<std::string, UniformValue> |
| Key-value pair mapping a uniform name to its value. | |
| using | SamplerKeyValue = std::tuple<uint32_t, ResourceId> |
| Key-value pair mapping a sampler binding index to an image resource id. | |
Public Member Functions | |
| DLL | Material () |
| Default constructor. | |
| DLL | Material (const Material &aMaterial) |
| The Copy Contsructor is used for virtual copying. | |
| DLL Material & | operator= (const Material &aMaterial) |
| Assignment operator due to rule of zero/three/five. | |
| Material & | operator= (Material &&)=delete |
| No move assignment allowed. | |
| Material (Material &&)=delete | |
| No move allowed. | |
| DLL | ~Material () final |
| Destructor. | |
| DLL const std::vector< uint8_t > & | GetUniformBuffer () const |
| Get the raw uniform buffer. | |
Loaders | |
| DLL void | LoadFromPBMsg (const MaterialMsg &aMaterialMsg) |
| Load material data from a protobuf message. | |
| DLL void | LoadFromMemory (const void *aBuffer, size_t aBufferSize) final |
| Load material data from a raw memory buffer. | |
| DLL void | Unload () final |
| Unload material data and release resources. | |
Property and Sampler Setters | |
| DLL void | Set (size_t aIndex, const UniformValue &aValue) |
| Set a uniform value by index. | |
| DLL void | Set (const UniformKeyValue &aValue) |
| Set a uniform value by name-value pair. | |
| DLL void | SetSampler (const std::string &aName, const ResourceId &aValue) |
| Set a sampler binding by name. | |
Property and Sampler Getters | |
| DLL ResourceId | GetSampler (const std::string &aName) |
| Get the resource id of a sampler by name. | |
| DLL const std::vector< std::tuple< uint32_t, ResourceId > > & | GetSamplers () const |
| Get all sampler bindings. | |
| Public Member Functions inherited from AeonGames::Resource | |
| virtual | ~Resource () |
| Virtual destructor. | |
| DLL void | LoadFromId (uint32_t aId) |
| Load the resource identified by a numeric id. | |
| DLL void | LoadFromFile (const std::string &aFilename) |
| Load the resource from a file on disk. | |
| DLL size_t | GetConsecutiveId () const |
| Get the Consecutive Id for the resource object. | |
Represents a surface material with uniform properties and texture samplers.
Definition at line 37 of file Material.hpp.
| using AeonGames::Material::SamplerKeyValue = std::tuple<uint32_t, ResourceId> |
Key-value pair mapping a sampler binding index to an image resource id.
Definition at line 45 of file Material.hpp.
| using AeonGames::Material::UniformKeyValue = std::tuple<std::string, UniformValue> |
Key-value pair mapping a uniform name to its value.
Definition at line 43 of file Material.hpp.
| using AeonGames::Material::UniformValue = std::variant<uint32_t, int32_t, float, Vector2, Vector3, Vector4, Matrix4x4> |
Variant type holding any supported uniform value.
Definition at line 41 of file Material.hpp.
| AeonGames::Material::Material | ( | const Material & | aMaterial | ) |
The Copy Contsructor is used for virtual copying.
Definition at line 37 of file Material.cpp.
| ResourceId AeonGames::Material::GetSampler | ( | const std::string & | aName | ) |
Get the resource id of a sampler by name.
| aName | Sampler name. |
Definition at line 250 of file Material.cpp.
| const std::vector< std::tuple< uint32_t, ResourceId > > & AeonGames::Material::GetSamplers | ( | ) | const |
Get all sampler bindings.
Definition at line 245 of file Material.cpp.
| const std::vector< uint8_t > & AeonGames::Material::GetUniformBuffer | ( | ) | const |
Get the raw uniform buffer.
Definition at line 45 of file Material.cpp.
|
finalvirtual |
Load material data from a raw memory buffer.
| aBuffer | Pointer to the buffer. |
| aBufferSize | Size of the buffer in bytes. |
Implements AeonGames::Resource.
Definition at line 186 of file Material.cpp.
| void AeonGames::Material::LoadFromPBMsg | ( | const MaterialMsg & | aMaterialMsg | ) |
Load material data from a protobuf message.
| aMaterialMsg | The protobuf message to load from. |
Definition at line 191 of file Material.cpp.
Assignment operator due to rule of zero/three/five.
Definition at line 38 of file Material.cpp.
| void AeonGames::Material::Set | ( | const UniformKeyValue & | aValue | ) |
Set a uniform value by name-value pair.
| aValue | Key-value pair with the uniform name and value. |
Definition at line 210 of file Material.cpp.
| void AeonGames::Material::Set | ( | size_t | aIndex, |
| const UniformValue & | aValue ) |
Set a uniform value by index.
| aIndex | Index of the uniform variable. |
| aValue | New value to assign. |
Definition at line 205 of file Material.cpp.
| void AeonGames::Material::SetSampler | ( | const std::string & | aName, |
| const ResourceId & | aValue ) |
Set a sampler binding by name.
| aName | Sampler name. |
| aValue | Resource id of the image to bind. |
Definition at line 231 of file Material.cpp.
|
finalvirtual |
Unload material data and release resources.
Implements AeonGames::Resource.
Definition at line 265 of file Material.cpp.