Raftel Engine
 
Loading...
Searching...
No Matches
Raftel::Material Class Reference

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< TexturegetAlbedoText ()
 Get the albedo (diffuse) texture.
 
std::shared_ptr< TexturegetNormalText ()
 Get the normal map texture.
 
std::shared_ptr< TexturegetRoughnessText ()
 Get the roughness texture.
 
std::shared_ptr< TexturegetMetallicText ()
 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.
 

Detailed Description

Represents a material with textures and physical properties.

Definition at line 43 of file material.hpp.

Constructor & Destructor Documentation

◆ Material()

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.

Parameters
albedoAlbedo (diffuse) texture.
normalNormal map texture.
roughnessRoughness texture.
metallicMetallic texture.
albedoColorBase color when no albedo texture is provided.
shininessShininess factor (Phong lighting model).
roughnessValueScalar roughness value (0.0 to 1.0).
metallicValueScalar metallic value (0.0 to 1.0).
fresnelFresnel reflection coefficient.
scattScattering factor.

Member Function Documentation

◆ getAlbedoColor()

glm::vec3 Raftel::Material::getAlbedoColor ( )
inline

Get the albedo color (used when no albedo texture is provided).

Returns
The albedo color as a glm::vec3.

Definition at line 152 of file material.hpp.

◆ getAlbedoText()

std::shared_ptr< Texture > Raftel::Material::getAlbedoText ( )

Get the albedo (diffuse) texture.

Returns
A shared pointer to the albedo texture.

◆ getFresnelValue()

float Raftel::Material::getFresnelValue ( )
inline

Get the fresnel value of the material.

Returns
The fresnel value.

Definition at line 176 of file material.hpp.

◆ getLastError()

const std::string & Raftel::Material::getLastError ( ) const
inline

Retrieves the last recorded error message.

Returns
A string containing the last error message.

Definition at line 237 of file material.hpp.

◆ getMetallicText()

std::shared_ptr< Texture > Raftel::Material::getMetallicText ( )

Get the metallic texture.

Returns
A shared pointer to the metallic texture.

◆ getMetallicValue()

float Raftel::Material::getMetallicValue ( )
inline

Get the metallic value of the material.

Returns
The metallic value.

Definition at line 170 of file material.hpp.

◆ getNormalText()

std::shared_ptr< Texture > Raftel::Material::getNormalText ( )

Get the normal map texture.

Returns
A shared pointer to the normal texture.

◆ GetNTextures()

int Raftel::Material::GetNTextures ( )
inline

Get the number of active textures assigned to the material.

Returns
The number of textures assigned to the material.

Definition at line 224 of file material.hpp.

◆ getRoughnessText()

std::shared_ptr< Texture > Raftel::Material::getRoughnessText ( )

Get the roughness texture.

Returns
A shared pointer to the roughness texture.

◆ getRoughnessValue()

float Raftel::Material::getRoughnessValue ( )
inline

Get the roughness value of the material.

Returns
The roughness value.

Definition at line 164 of file material.hpp.

◆ getScatteringValue()

float Raftel::Material::getScatteringValue ( )
inline

Get the scattering value of the material.

Returns
The scattering value.

Definition at line 182 of file material.hpp.

◆ getShininessValue()

float Raftel::Material::getShininessValue ( )
inline

Get the shininess value of the material.

Returns
The shininess value.

Definition at line 158 of file material.hpp.

◆ setAlbedo()

void Raftel::Material::setAlbedo ( std::shared_ptr< Texture > texture)

Set the albedo (diffuse) texture of the material.

Parameters
textureThe texture to set as albedo.

◆ setAlbedoColor()

void Raftel::Material::setAlbedoColor ( const glm::vec3 & color)

Set the albedo color (used when no albedo texture is provided).

Parameters
colorThe color to set as albedo.

◆ setFresnel()

void Raftel::Material::setFresnel ( float value)

Set the fresnel value of the material.

Parameters
valueThe fresnel value to set.

◆ setMetallic() [1/2]

void Raftel::Material::setMetallic ( float value)

Set the metallic value of the material.

Parameters
valueThe metallic value to set.

◆ setMetallic() [2/2]

void Raftel::Material::setMetallic ( std::shared_ptr< Texture > texture)

Set the metallic texture of the material.

Parameters
textureThe texture to set as metallic.

◆ setNormal()

void Raftel::Material::setNormal ( std::shared_ptr< Texture > texture)

Set the normal map texture of the material.

Parameters
textureThe texture to set as normal.

◆ setRoughness() [1/2]

void Raftel::Material::setRoughness ( float value)

Set the roughness value of the material.

Parameters
valueThe roughness value to set.

◆ setRoughness() [2/2]

void Raftel::Material::setRoughness ( std::shared_ptr< Texture > texture)

Set the roughness texture of the material.

Parameters
textureThe texture to set as roughness.

◆ setScattering()

void Raftel::Material::setScattering ( float value)

Set the scattering value of the material.

Parameters
valueThe scattering value to set.

◆ setShininess()

void Raftel::Material::setShininess ( float value)

Set the shininess value of the material.

Parameters
valueThe shininess value to set.

Member Data Documentation

◆ bAlbedo

bool Raftel::Material::bAlbedo

True if an albedo texture is assigned.

Definition at line 228 of file material.hpp.

◆ bMetallic

bool Raftel::Material::bMetallic

True if a metallic texture is assigned.

Definition at line 231 of file material.hpp.

◆ bNormal

bool Raftel::Material::bNormal

True if a normal texture is assigned.

Definition at line 229 of file material.hpp.

◆ bRoughness

bool Raftel::Material::bRoughness

True if a roughness texture is assigned.

Definition at line 230 of file material.hpp.


The documentation for this class was generated from the following file: