MAGE  v0.171.0
Matthias Advanced Game Engine
mage::rendering::Material Class Reference

#include <material.hpp>

Public Member Functions

 Material (std::string name="material")
 
 Material (const Material &material)=default
 
 Material (Material &&material) noexcept=default
 
 ~Material ()=default
 
Materialoperator= (const Material &material)=default
 
Materialoperator= (Material &&material) noexcept=default
 
RGBAGetBaseColor () noexcept
 
const RGBAGetBaseColor () const noexcept
 
TexturePtr GetBaseColorTexture () const noexcept
 
ID3D11ShaderResourceView * GetBaseColorSRV () const noexcept
 
void SetBaseColorTexture (TexturePtr base_color_texture) noexcept
 
F32 GetRoughness () const noexcept
 
void SetRoughness (F32 roughness) noexcept
 
F32 GetMetalness () const noexcept
 
void SetMetalness (F32 metalness) noexcept
 
const RGBA GetMaterialRGBA () const noexcept
 
TexturePtr GetMaterialTexture () const noexcept
 
ID3D11ShaderResourceView * GetMaterialSRV () const noexcept
 
void SetMaterialTexture (TexturePtr material_texture) noexcept
 
TexturePtr GetNormalTexture () const noexcept
 
ID3D11ShaderResourceView * GetNormalSRV () const noexcept
 
void SetNormalTexture (TexturePtr normal_texture)
 
bool IsOpaque () const noexcept
 
bool IsTransparant () const noexcept
 
void SetOpaque () noexcept
 
void SetTransparent (bool transparent=true) noexcept
 
F32 GetRadiance () const noexcept
 
void SetRadiance (F32 radiance) noexcept
 
const RGB GetRadianceSpectrum () const noexcept
 
bool IsEmissive () const noexcept
 
const std::string_view GetName () const noexcept
 
void SetName (std::string name) noexcept
 

Private Attributes

RGBA m_base_color
 
TexturePtr m_base_color_texture
 
F32 m_roughness
 
F32 m_metalness
 
TexturePtr m_material_texture
 
TexturePtr m_normal_texture
 
bool m_transparent
 
F32 m_radiance
 
std::string m_name
 

Detailed Description

A class of materials.

Constructor & Destructor Documentation

◆ Material() [1/3]

mage::rendering::Material::Material ( std::string  name = "material")
explicit

Constructs a material.

Parameters
[in]nameThe name of the material.

◆ Material() [2/3]

mage::rendering::Material::Material ( const Material material)
default

Constructs a material from the given material.

Parameters
[in]materialA reference to the material to copy.

◆ Material() [3/3]

mage::rendering::Material::Material ( Material &&  material)
defaultnoexcept

Constructs a material by moving the given material.

Parameters
[in]materialA reference to the material to move.

◆ ~Material()

mage::rendering::Material::~Material ( )
default

Destructs this material.

Member Function Documentation

◆ GetBaseColor() [1/2]

RGBA& mage::rendering::Material::GetBaseColor ( )
noexcept

Returns the (linear) base color of this material.

Returns
A reference to the (linear) base color of this material.

◆ GetBaseColor() [2/2]

const RGBA& mage::rendering::Material::GetBaseColor ( ) const
noexcept

Returns the (linear) base color of this material.

Returns
A reference to the (linear) base color of this material.

◆ GetBaseColorSRV()

ID3D11ShaderResourceView* mage::rendering::Material::GetBaseColorSRV ( ) const
noexcept

Returns the shader resource view of the base color texture of this material.

Returns
nullptr, if this material has no base color texture.
A pointer to the shader resource view of the base color texture of this material.

◆ GetBaseColorTexture()

TexturePtr mage::rendering::Material::GetBaseColorTexture ( ) const
noexcept

Returns the base color texture of this material.

Returns
A pointer to the base color texture of this material.

◆ GetMaterialRGBA()

const RGBA mage::rendering::Material::GetMaterialRGBA ( ) const
noexcept

Returns the material RGBA channels of this material.

Returns
The material RGBA channels of this material.

◆ GetMaterialSRV()

ID3D11ShaderResourceView* mage::rendering::Material::GetMaterialSRV ( ) const
noexcept

Returns the shader resource view of the material texture of this material.

Returns
nullptr, if this material has no material texture.
A pointer to the shader resource view of the material texture of this material.

◆ GetMaterialTexture()

TexturePtr mage::rendering::Material::GetMaterialTexture ( ) const
noexcept

Returns the material texture of this material.

Returns
A pointer to the material texture of this material.

◆ GetMetalness()

F32 mage::rendering::Material::GetMetalness ( ) const
noexcept

Returns the metalness of this material.

Returns
The metalness of this material.

◆ GetName()

const std::string_view mage::rendering::Material::GetName ( ) const
noexcept

Returns the name of this material.

Returns
The name of this material.

◆ GetNormalSRV()

ID3D11ShaderResourceView* mage::rendering::Material::GetNormalSRV ( ) const
noexcept

Returns the shader resource view of the normal texture of this material.

Returns
nullptr, if this material has no normal texture.
A pointer to the shader resource view of the normal texture of this material.

◆ GetNormalTexture()

TexturePtr mage::rendering::Material::GetNormalTexture ( ) const
noexcept

Returns the normal texture of this material.

Returns
A pointer to the normal texture of this material.

◆ GetRadiance()

F32 mage::rendering::Material::GetRadiance ( ) const
noexcept

Returns the radiance of this material.

Returns
The radiance in watts per square meter per steradians of this material.

◆ GetRadianceSpectrum()

const RGB mage::rendering::Material::GetRadianceSpectrum ( ) const
noexcept

Returns the radiance spectrum of this material.

Returns
The radiance spectrum of this material.

◆ GetRoughness()

F32 mage::rendering::Material::GetRoughness ( ) const
noexcept

Returns the roughness of this material.

Returns
The roughness of this material.

◆ IsEmissive()

bool mage::rendering::Material::IsEmissive ( ) const
noexcept

Checks whether this material is emissive and acts as a black body.

Returns
true if this material is emissive and acts as a black body. false otherwise.

◆ IsOpaque()

bool mage::rendering::Material::IsOpaque ( ) const
noexcept

Checks whether this material is opaque (i.e. contains alpha channel equal to 1.0).

Returns
true if and only if this material is opaque. false otherwise.

◆ IsTransparant()

bool mage::rendering::Material::IsTransparant ( ) const
noexcept

Checks whether this material is transparent (i.e. contains alpha channel not equal to 1.0).

Returns
true if and only if this material is transparent. false otherwise.

◆ operator=() [1/2]

Material& mage::rendering::Material::operator= ( const Material material)
default

Copies the given material to this material.

Parameters
[in]materialA reference to the material to copy.
Returns
A reference to the copy of the given material (i.e. this material).

◆ operator=() [2/2]

Material& mage::rendering::Material::operator= ( Material &&  material)
defaultnoexcept

Moves the given material to this material.

Parameters
[in]materialA reference to the material to move.
Returns
A reference to the moved material (i.e. this material).

◆ SetBaseColorTexture()

void mage::rendering::Material::SetBaseColorTexture ( TexturePtr  base_color_texture)
noexcept

Sets the base color texture of this material to the given base color texture.

Parameters
[in]base_color_textureA pointer to the base color texture.

◆ SetMaterialTexture()

void mage::rendering::Material::SetMaterialTexture ( TexturePtr  material_texture)
noexcept

Sets the material texture of this material to the given material texture.

Parameters
[in]material_textureA pointer to the material texture.

◆ SetMetalness()

void mage::rendering::Material::SetMetalness ( F32  metalness)
noexcept

Sets the metalness of this material to the given value.

Parameters
[in]metalnessThe metalness.

◆ SetName()

void mage::rendering::Material::SetName ( std::string  name)
noexcept

Sets the name of this material to the given name.

Parameters
[in]nameThe name.

◆ SetNormalTexture()

void mage::rendering::Material::SetNormalTexture ( TexturePtr  normal_texture)

Sets the normal texture of this material to the given normal texture.

Parameters
[in]normal_textureThe normal texture.

◆ SetOpaque()

void mage::rendering::Material::SetOpaque ( )
noexcept

Makes this material opaque.

◆ SetRadiance()

void mage::rendering::Material::SetRadiance ( F32  radiance)
noexcept

Sets the radiance of this material to the given radiance.

Parameters
[in]radianceThe radiance in watts per square meter per steradians.

◆ SetRoughness()

void mage::rendering::Material::SetRoughness ( F32  roughness)
noexcept

Sets the roughness of this material to the given value.

Parameters
[in]roughnessThe roughness.

◆ SetTransparent()

void mage::rendering::Material::SetTransparent ( bool  transparent = true)
noexcept

Makes this material transparent.

Parameters
[in]transparenttrue if and only if this material is transparent. false otherwise.

Member Data Documentation

◆ m_base_color

RGBA mage::rendering::Material::m_base_color
private

The (linear) base color of this material.

◆ m_base_color_texture

TexturePtr mage::rendering::Material::m_base_color_texture
private

A pointer to the base color texture of this material.

◆ m_material_texture

TexturePtr mage::rendering::Material::m_material_texture
private

A pointer to the material texture of this material.

The red channel contains the roughness of this material. The blue channel contains the metalness of this material.

◆ m_metalness

F32 mage::rendering::Material::m_metalness
private

The metalness of this material.

◆ m_name

std::string mage::rendering::Material::m_name
private

The name of this material.

◆ m_normal_texture

TexturePtr mage::rendering::Material::m_normal_texture
private

A pointer to the normal texture of this material.

◆ m_radiance

F32 mage::rendering::Material::m_radiance
private

The radiance in watts per square meter per steradians of this material.

◆ m_roughness

F32 mage::rendering::Material::m_roughness
private

The roughness of this material.

◆ m_transparent

bool mage::rendering::Material::m_transparent
private

Flag indicating whether this material is transparent. This flag is true if this material could contain transparent parts. false otherwise.