Represents a material with textures and physical properties. More...
#include <material.hpp>
Public Member Functions | |
Material () | |
Default constructor initializes a basic white material with no textures. | |
Material (std::shared_ptr< Texture > albedo, std::shared_ptr< Texture > normal=nullptr, std::shared_ptr< Texture > roughness=nullptr, std::shared_ptr< Texture > metallic=nullptr, const glm::vec3 &albedoColor=glm::vec3(1.0f), float shininess=32.0f, float roughnessValue=0.5f, float metallicValue=0.0f, float fresnel=1.0f, float scatt=0.0f) | |
Constructs a Material with textures and properties. | |
void | setAlbedo (std::shared_ptr< Texture > texture) |
Set the albedo (diffuse) texture of the material. | |
void | setNormal (std::shared_ptr< Texture > texture) |
Set the normal map texture of the material. | |
void | setRoughness (std::shared_ptr< Texture > texture) |
Set the roughness texture of the material. | |
void | setMetallic (std::shared_ptr< Texture > texture) |
Set the metallic texture of the material. | |
void | deleteAlbedo () |
Remove the albedo texture. | |
void | deleteNormal () |
Remove the normal texture. | |
void | deleteRoughness () |
Remove the roughness texture. | |
void | deleteMetallic () |
Remove the metallic texture. | |
std::shared_ptr< Texture > | getAlbedoText () |
Get the albedo (diffuse) texture. | |
std::shared_ptr< Texture > | getNormalText () |
Get the normal map texture. | |
std::shared_ptr< Texture > | getRoughnessText () |
Get the roughness texture. | |
std::shared_ptr< Texture > | getMetallicText () |
Get the metallic texture. | |
glm::vec3 | getAlbedoColor () |
Get the albedo color (used when no albedo texture is provided). | |
float | getShininessValue () |
Get the shininess value of the material. | |
float | getRoughnessValue () |
Get the roughness value of the material. | |
float | getMetallicValue () |
Get the metallic value of the material. | |
float | getFresnelValue () |
Get the fresnel value of the material. | |
float | getScatteringValue () |
Get the scattering value of the material. | |
void | setAlbedoColor (const glm::vec3 &color) |
Set the albedo color (used when no albedo texture is provided). | |
void | setShininess (float value) |
Set the shininess value of the material. | |
void | setRoughness (float value) |
Set the roughness value of the material. | |
void | setMetallic (float value) |
Set the metallic value of the material. | |
void | setFresnel (float value) |
Set the fresnel value of the material. | |
void | setScattering (float value) |
Set the scattering value of the material. | |
int | GetNTextures () |
Get the number of active textures assigned to the material. | |
const std::string & | getLastError () const |
Retrieves the last recorded error message. | |
Public Attributes | |
bool | bAlbedo |
True if an albedo texture is assigned. | |
bool | bNormal |
True if a normal texture is assigned. | |
bool | bRoughness |
True if a roughness texture is assigned. | |
bool | bMetallic |
True if a metallic texture is assigned. | |
Represents a material with textures and physical properties.
Definition at line 43 of file material.hpp.
Raftel::Material::Material | ( | std::shared_ptr< Texture > | albedo, |
std::shared_ptr< Texture > | normal = nullptr, | ||
std::shared_ptr< Texture > | roughness = nullptr, | ||
std::shared_ptr< Texture > | metallic = nullptr, | ||
const glm::vec3 & | albedoColor = glm::vec3(1.0f), | ||
float | shininess = 32.0f, | ||
float | roughnessValue = 0.5f, | ||
float | metallicValue = 0.0f, | ||
float | fresnel = 1.0f, | ||
float | scatt = 0.0f ) |
Constructs a Material with textures and properties.
albedo | Albedo (diffuse) texture. |
normal | Normal map texture. |
roughness | Roughness texture. |
metallic | Metallic texture. |
albedoColor | Base color when no albedo texture is provided. |
shininess | Shininess factor (Phong lighting model). |
roughnessValue | Scalar roughness value (0.0 to 1.0). |
metallicValue | Scalar metallic value (0.0 to 1.0). |
fresnel | Fresnel reflection coefficient. |
scatt | Scattering factor. |
|
inline |
Get the albedo color (used when no albedo texture is provided).
Definition at line 152 of file material.hpp.
std::shared_ptr< Texture > Raftel::Material::getAlbedoText | ( | ) |
Get the albedo (diffuse) texture.
|
inline |
Get the fresnel value of the material.
Definition at line 176 of file material.hpp.
|
inline |
Retrieves the last recorded error message.
Definition at line 237 of file material.hpp.
std::shared_ptr< Texture > Raftel::Material::getMetallicText | ( | ) |
Get the metallic texture.
|
inline |
Get the metallic value of the material.
Definition at line 170 of file material.hpp.
std::shared_ptr< Texture > Raftel::Material::getNormalText | ( | ) |
Get the normal map texture.
|
inline |
Get the number of active textures assigned to the material.
Definition at line 224 of file material.hpp.
std::shared_ptr< Texture > Raftel::Material::getRoughnessText | ( | ) |
Get the roughness texture.
|
inline |
Get the roughness value of the material.
Definition at line 164 of file material.hpp.
|
inline |
Get the scattering value of the material.
Definition at line 182 of file material.hpp.
|
inline |
Get the shininess value of the material.
Definition at line 158 of file material.hpp.
void Raftel::Material::setAlbedo | ( | std::shared_ptr< Texture > | texture | ) |
Set the albedo (diffuse) texture of the material.
texture | The texture to set as albedo. |
void Raftel::Material::setAlbedoColor | ( | const glm::vec3 & | color | ) |
Set the albedo color (used when no albedo texture is provided).
color | The color to set as albedo. |
void Raftel::Material::setFresnel | ( | float | value | ) |
Set the fresnel value of the material.
value | The fresnel value to set. |
void Raftel::Material::setMetallic | ( | float | value | ) |
Set the metallic value of the material.
value | The metallic value to set. |
void Raftel::Material::setMetallic | ( | std::shared_ptr< Texture > | texture | ) |
Set the metallic texture of the material.
texture | The texture to set as metallic. |
void Raftel::Material::setNormal | ( | std::shared_ptr< Texture > | texture | ) |
Set the normal map texture of the material.
texture | The texture to set as normal. |
void Raftel::Material::setRoughness | ( | float | value | ) |
Set the roughness value of the material.
value | The roughness value to set. |
void Raftel::Material::setRoughness | ( | std::shared_ptr< Texture > | texture | ) |
Set the roughness texture of the material.
texture | The texture to set as roughness. |
void Raftel::Material::setScattering | ( | float | value | ) |
Set the scattering value of the material.
value | The scattering value to set. |
void Raftel::Material::setShininess | ( | float | value | ) |
Set the shininess value of the material.
value | The shininess value to set. |
bool Raftel::Material::bAlbedo |
True if an albedo texture is assigned.
Definition at line 228 of file material.hpp.
bool Raftel::Material::bMetallic |
True if a metallic texture is assigned.
Definition at line 231 of file material.hpp.
bool Raftel::Material::bNormal |
True if a normal texture is assigned.
Definition at line 229 of file material.hpp.
bool Raftel::Material::bRoughness |
True if a roughness texture is assigned.
Definition at line 230 of file material.hpp.