26#define __MATERIAL_H__ 1
32#include <unordered_map>
67 std::shared_ptr<Texture> albedo,
68 std::shared_ptr<Texture> normal =
nullptr,
69 std::shared_ptr<Texture> roughness =
nullptr,
70 std::shared_ptr<Texture> metallic =
nullptr,
71 const glm::vec3& albedoColor = glm::vec3(1.0f),
72 float shininess = 32.0f,
73 float roughnessValue = 0.5f,
74 float metallicValue = 0.0f,
246 std::shared_ptr<Texture> albedo;
247 std::shared_ptr<Texture> normal;
248 std::shared_ptr<Texture> roughness;
249 std::shared_ptr<Texture> metallic;
251 glm::vec3 albedoColor;
253 float roughnessValue;
258 int texture_counter = 0;
266 void setError(
const std::string& errorMessage,
const char* file,
int line);
267 std::string lastError;
Represents a material with textures and physical properties.
void deleteMetallic()
Remove the metallic texture.
bool bNormal
True if a normal texture is assigned.
std::shared_ptr< Texture > getAlbedoText()
Get the albedo (diffuse) texture.
void setRoughness(float value)
Set the roughness value of the material.
bool bRoughness
True if a roughness texture is assigned.
void setAlbedo(std::shared_ptr< Texture > texture)
Set the albedo (diffuse) texture of the material.
bool bMetallic
True if a metallic texture is assigned.
void deleteRoughness()
Remove the roughness texture.
bool bAlbedo
True if an albedo texture is assigned.
std::shared_ptr< Texture > getNormalText()
Get the normal map texture.
std::shared_ptr< Texture > getMetallicText()
Get the metallic texture.
void deleteNormal()
Remove the normal texture.
void setFresnel(float value)
Set the fresnel value of the material.
const std::string & getLastError() const
Retrieves the last recorded error message.
float getRoughnessValue()
Get the roughness value of the material.
void deleteAlbedo()
Remove the albedo texture.
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.
int GetNTextures()
Get the number of active textures assigned to the material.
void setScattering(float value)
Set the scattering value of the material.
float getFresnelValue()
Get the fresnel value of the material.
glm::vec3 getAlbedoColor()
Get the albedo color (used when no albedo texture is provided).
float getMetallicValue()
Get the metallic value of the material.
void setMetallic(std::shared_ptr< Texture > texture)
Set the metallic texture of the material.
void setMetallic(float value)
Set the metallic value of the material.
void setRoughness(std::shared_ptr< Texture > texture)
Set the roughness texture of the material.
void setAlbedoColor(const glm::vec3 &color)
Set the albedo color (used when no albedo texture is provided).
Material()
Default constructor initializes a basic white material with no textures.
float getScatteringValue()
Get the scattering value of the material.
void setShininess(float value)
Set the shininess value of the material.
float getShininessValue()
Get the shininess value of the material.
std::shared_ptr< Texture > getRoughnessText()
Get the roughness texture.
void setNormal(std::shared_ptr< Texture > texture)
Set the normal map texture of the material.
Contains the definitions for the TextureImage and Texture classes.