lmgl 1.0.0
A lightweight OpenGL graphics engine library written in C++
Loading...
Searching...
No Matches
lmgl::scene::Material Class Reference

Represents a material with various properties and textures for 3D rendering. More...

#include <material.hpp>

Public Member Functions

 Material (const std::string &name="Default Material")
 Constructs a Material with an optional name.
 
const std::string & get_name () const
 Gets the name of the material.
 
void set_name (const std::string &name)
 Sets the name of the material.
 
const glm::vec3 & get_albedo () const
 Gets the albedo color of the material.
 
void set_albedo (const glm::vec3 &albedo)
 Sets the albedo color of the material.
 
float get_metallic () const
 Gets the metallic property of the material.
 
void set_metallic (float metallic)
 Sets the metallic property of the material.
 
float get_roughness () const
 Gets the roughness property of the material.
 
void set_roughness (float roughness)
 Sets the roughness property of the material.
 
float get_ao () const
 Gets the ambient occlusion (AO) property of the material.
 
void set_ao (float ao)
 Sets the ambient occlusion (AO) property of the material.
 
const glm::vec3 & get_emissive () const
 Gets the emissive color of the material.
 
void set_emissive (const glm::vec3 &emissive)
 Sets the emissive color of the material.
 
void set_albedo_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the albedo texture map of the material.
 
void set_normal_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the normal texture map of the material.
 
void set_metallic_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the metallic texture map of the material.
 
void set_roughness_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the roughness texture map of the material.
 
void set_ao_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the ambient occlusion (AO) texture map of the material.
 
void set_emissive_map (const std::shared_ptr< renderer::Texture > &texture)
 Sets the emissive texture map of the material.
 
std::shared_ptr< renderer::Textureget_albedo_map () const
 Gets the albedo texture map of the material.
 
std::shared_ptr< renderer::Textureget_normal_map () const
 Gets the normal texture map of the material.
 
std::shared_ptr< renderer::Textureget_metallic_map () const
 Gets the metallic texture map of the material.
 
std::shared_ptr< renderer::Textureget_roughness_map () const
 Gets the roughness texture map of the material.
 
std::shared_ptr< renderer::Textureget_ao_map () const
 Gets the ambient occlusion (AO) texture map of the material.
 
std::shared_ptr< renderer::Textureget_emissive_map () const
 Gets the emissive texture map of the material.
 
void bind (const std::shared_ptr< renderer::Shader > &shader) const
 Binds the material properties and textures to the given shader.
 

Detailed Description

Represents a material with various properties and textures for 3D rendering.

The Material class encapsulates properties such as albedo, metallic, roughness, ambient occlusion, and emissive characteristics, along with their corresponding texture maps. It provides methods to set and retrieve these properties and bind them to a shader for rendering.

Constructor & Destructor Documentation

◆ Material()

lmgl::scene::Material::Material ( const std::string & name = "Default Material")

Constructs a Material with an optional name.

Creates a Material object with the specified name. If no name is provided, it defaults to "Default Material".

Parameters
nameThe name of the material.

Member Function Documentation

◆ bind()

void lmgl::scene::Material::bind ( const std::shared_ptr< renderer::Shader > & shader) const

Binds the material properties and textures to the given shader.

This method sets the material properties and binds the associated texture maps to the provided shader for rendering.

Parameters
shaderA shared pointer to the shader to bind the material to.

◆ get_albedo()

const glm::vec3 & lmgl::scene::Material::get_albedo ( ) const
inline

Gets the albedo color of the material.

Returns
The albedo color as a glm::vec3.

◆ get_albedo_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_albedo_map ( ) const
inline

Gets the albedo texture map of the material.

Returns
A shared pointer to the albedo texture.

◆ get_ao()

float lmgl::scene::Material::get_ao ( ) const
inline

Gets the ambient occlusion (AO) property of the material.

Returns
The AO value as a float.

◆ get_ao_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_ao_map ( ) const
inline

Gets the ambient occlusion (AO) texture map of the material.

Returns
A shared pointer to the AO texture.

◆ get_emissive()

const glm::vec3 & lmgl::scene::Material::get_emissive ( ) const
inline

Gets the emissive color of the material.

Returns
The emissive color as a glm::vec3.

◆ get_emissive_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_emissive_map ( ) const
inline

Gets the emissive texture map of the material.

Returns
A shared pointer to the emissive texture.

◆ get_metallic()

float lmgl::scene::Material::get_metallic ( ) const
inline

Gets the metallic property of the material.

Returns
The metallic value as a float.

◆ get_metallic_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_metallic_map ( ) const
inline

Gets the metallic texture map of the material.

Returns
A shared pointer to the metallic texture.

◆ get_name()

const std::string & lmgl::scene::Material::get_name ( ) const
inline

Gets the name of the material.

Returns
The name of the material.

◆ get_normal_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_normal_map ( ) const
inline

Gets the normal texture map of the material.

Returns
A shared pointer to the normal texture.

◆ get_roughness()

float lmgl::scene::Material::get_roughness ( ) const
inline

Gets the roughness property of the material.

Returns
The roughness value as a float.

◆ get_roughness_map()

std::shared_ptr< renderer::Texture > lmgl::scene::Material::get_roughness_map ( ) const
inline

Gets the roughness texture map of the material.

Returns
A shared pointer to the roughness texture.

◆ set_albedo()

void lmgl::scene::Material::set_albedo ( const glm::vec3 & albedo)
inline

Sets the albedo color of the material.

Parameters
albedoThe new albedo color as a glm::vec3.

◆ set_albedo_map()

void lmgl::scene::Material::set_albedo_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the albedo texture map of the material.

Parameters
textureA shared pointer to the albedo texture.

◆ set_ao()

void lmgl::scene::Material::set_ao ( float ao)
inline

Sets the ambient occlusion (AO) property of the material.

Parameters
aoThe new AO value as a float.

◆ set_ao_map()

void lmgl::scene::Material::set_ao_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the ambient occlusion (AO) texture map of the material.

Parameters
textureA shared pointer to the AO texture.

◆ set_emissive()

void lmgl::scene::Material::set_emissive ( const glm::vec3 & emissive)
inline

Sets the emissive color of the material.

Parameters
emissiveThe new emissive color as a glm::vec3.

◆ set_emissive_map()

void lmgl::scene::Material::set_emissive_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the emissive texture map of the material.

Parameters
textureA shared pointer to the emissive texture.

◆ set_metallic()

void lmgl::scene::Material::set_metallic ( float metallic)
inline

Sets the metallic property of the material.

Parameters
metallicThe new metallic value as a float.

◆ set_metallic_map()

void lmgl::scene::Material::set_metallic_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the metallic texture map of the material.

Parameters
textureA shared pointer to the metallic texture.

◆ set_name()

void lmgl::scene::Material::set_name ( const std::string & name)
inline

Sets the name of the material.

Parameters
nameThe new name for the material.

◆ set_normal_map()

void lmgl::scene::Material::set_normal_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the normal texture map of the material.

Parameters
textureA shared pointer to the normal texture.

◆ set_roughness()

void lmgl::scene::Material::set_roughness ( float roughness)
inline

Sets the roughness property of the material.

Parameters
roughnessThe new roughness value as a float.

◆ set_roughness_map()

void lmgl::scene::Material::set_roughness_map ( const std::shared_ptr< renderer::Texture > & texture)

Sets the roughness texture map of the material.

Parameters
textureA shared pointer to the roughness texture.

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