Rendu
A lightweight rendering engine for experimentations
|
Represent a surface material, including textures describing the surface parameters. More...
#include <Material.hpp>
Public Types | |
enum | Type : int { None = 0 , Regular , Parallax , Clearcoat , Anisotropic , Sheen , Iridescent , Subsurface , Emissive , Transparent , TransparentIrid } |
Type of shading/effects. More... | |
Public Member Functions | |
Material ()=default | |
Material (Type type) | |
void | addTexture (const Texture *infos) |
void | addParameter (const glm::vec4 ¶m) |
const std::vector< const Texture * > & | textures () const |
const std::vector< glm::vec4 > & | parameters () const |
const Type & | type () const |
bool | twoSided () const |
bool | masked () const |
const std::string & | name () const |
bool | decode (const KeyValues ¶ms, Storage options) |
virtual KeyValues | encode () const |
virtual | ~Material ()=default |
Material (const Material &)=delete | |
Material & | operator= (const Material &)=delete |
Material (Material &&)=default | |
Material & | operator= (Material &&)=default |
Protected Attributes | |
std::vector< const Texture * > | _textures |
Textures used by the material. | |
std::vector< glm::vec4 > | _parameters |
Parameters used by the material. | |
std::string | _name |
The material name. | |
Type | _material = Type::None |
The material type. | |
bool | _twoSided = false |
Should faces of objects be visible from the two sides. | |
bool | _masked = false |
The material uses alpha cutout. | |
Represent a surface material, including textures describing the surface parameters.
Different predefined materials can be used, with predefined parameters stored in ordered textures.
Regular: GGX material, dielectric or conductor.
Parallax: GGX material with parallax occlusion mapping.
Clearcoat: GGX material with an additional dielectric transparent layer overlayed top.
Anisotropic: GGX material with anisotropic specular behavior.
Sheen: Cloth-like material, assumed to be a dielectric.
Iridescent: GGX material with thin-film interferences on the surface.
Subsurface: Dieletric GGX material with subsurface scattering/transmission.
Emissive: light emitting material, assume to be optionally covered by a transparent dielectric
Transparent: transparent object with a dieletric surface
TransparentIrid: transparent object with a dieletric surface and thin film interferences
None: any parameters can be specified depending on the shader used in the renderer code.
enum Material::Type : int |
Type of shading/effects.
|
default |
Constructor
Material::Material | ( | Type | type | ) |
Construct a new material.
type | the type of shading and effects associated with this material |
|
virtualdefault |
Destructor.
|
delete |
Copy constructor.
|
default |
Move constructor.
void Material::addParameter | ( | const glm::vec4 & | param | ) |
Register a new parameter.
param | the values to add |
void Material::addTexture | ( | const Texture * | infos | ) |
Register a texture.
infos | the texture infos to add |
Setup a material parameters from a list of key-value tuples. The following keywords will be searched for:
type: materialtype twosided: bool masked: bool textures: - texturetype: ... - ... parameters: - R,G,B,A - ...
params | the parameters tuple |
options | data loading and storage options |
|
virtual |
Generate a key-values representation of the material. See decode for the keywords and layout.
|
inline |
Should an alpha clip mask be applied when rendering the surface (for leaves or chains for instance).
|
inline |
Copy assignment.
Move assignment.
|
inline |
Parameters array getter.
|
inline |
Textures array getter.
|
inline |
Is the surface from both sides.
|
inline |
Type getter.