|
ModelViewer 0.1
Template for CPP projects
|
Class representing a material parsed from an MTL file. More...
#include <Material.hpp>


Signals | |
| void | KdChanged () |
| Signal emitted when the diffuse color changes. | |
| void | illuminationChanged () |
| Signal emitted when the illumination model changes. | |
| void | dChanged () |
| Signal emitted when the opacity changes. | |
| void | NsChanged () |
| Signal emitted when the specular roughness changes. | |
| void | sharpnessChanged () |
| Signal emitted when the sharpness changes. | |
| void | NiChanged () |
| Signal emitted when the index of refraction changes. | |
| void | metalnessChanged () |
| Signal emitted when the metalness changes. | |
| void | roughnessChanged () |
| Signal emitted when the roughness changes. | |
| void | bumpStrengthChanged () |
| Signal emitted when the bump strength changes. | |
| void | diffuseMapChanged () |
| Signal emitted when the diffuse map changes. | |
| void | specularReflectionMapChanged () |
| Signal emitted when the specular reflection map changes. | |
| void | specularMapChanged () |
| Signal emitted when the specular map changes. | |
| void | emissiveMapChanged () |
| Signal emitted when the emissive map changes. | |
| void | dissolveMapChanged () |
| Signal emitted when the dissolve map changes. | |
| void | bumpMapChanged () |
| Signal emitted when the bump map changes. | |
Public Member Functions | |
| MTLMaterial (QObject *parent=nullptr) | |
| Constructor. | |
| ~MTLMaterial () override=default | |
| Destructor. | |
| void | parseMTL (const std::string &filepath) |
| Parse an MTL file and set the material properties. | |
| void | resetMaterial () |
| Reset the material to default values. | |
| const QUrl & | getAmbientMap () const |
| Get the Ambient Map URL. | |
| const QUrl & | getDiffuseMap () const |
| Get the Diffuse Map URL. | |
| const QUrl & | getSpecularReflectionMap () const |
| Get the Specular Reflection Map URL. | |
| const QUrl & | getSpecularMap () const |
| Get the Specular Map URL. | |
| const QUrl & | getEmissiveMap () const |
| Get the Emissive Map URL. | |
| const QUrl & | getDissolveMap () const |
| Get the Dissolve Map URL. | |
| const QUrl & | getBumpMap () const |
| Get the Bump/Normal Map URL. | |
| const QUrl & | getDecalMap () const |
| Get the Decal Map URL. | |
| const QUrl & | getDispersionMap () const |
| Get the Dispersion Map URL. | |
Properties | |
| QColor | diffuseColor |
| qreal | illumination |
| qreal | metalness |
| qreal | roughness |
| qreal | bumpStrength |
| qreal | opacity |
| qreal | indexOfRefraction |
| QUrl | diffuseMap |
| QUrl | specularReflectionMap |
| QUrl | specularMap |
| QUrl | emissiveMap |
| QUrl | dissolveMap |
| QUrl | bumpMap |
Private Member Functions | |
| void | parseMaterial (std::ifstream &file) |
| Parse the MTL file line by line. | |
| void | setMaterialValues () |
| Apply parsed values to the material properties. | |
| void | parseScalar (const std::string &line, const std::string &key) |
| Parse a scalar value from an MTL line. | |
| void | parseColor (const std::string &line, const std::string &key) |
| Parse a color value from an MTL line. | |
| void | parseMap (const std::string &line, const std::string &key) |
| Parse a texture map from an MTL line. | |
Private Attributes | |
| std::filesystem::path | _parentPath |
| Parent path of the MTL file. | |
| QColor | _Ka |
| Ambient Color. | |
| QColor | _Kd |
| Diffuse Color. | |
| QColor | _Ks |
| Specular Color. | |
| QColor | _Ke |
| Emissive Color. | |
| QColor | _Tf |
| Transmission Filter. | |
| qreal | _illumination |
| Illumination Model. | |
| qreal | _d |
| Opacity. | |
| qreal | _Ns |
| Specular Roughness. | |
| qreal | _sharpness |
| Sharpness. | |
| qreal | _Ni |
| Index of Refraction. | |
| qreal | _metalness = 0.0 |
| Metalness. | |
| qreal | _roughness = 0.0 |
| Roughness. | |
| qreal | _bumpStrength = 0.0 |
| Bump/Normal Strength. | |
| QUrl | _ambientMap |
| Path to the Ambient Map. | |
| QUrl | _diffuseMap |
| Path to the Diffuse Map. | |
| QUrl | _specularReflectionMap |
| Path to the Specular Reflection Map. | |
| QUrl | _specularMap |
| Path to the Specular Map. | |
| QUrl | _emissiveMap |
| Path to the Emissive Map. | |
| QUrl | _dissolveMap |
| Path to the Dissolve Map. | |
| QUrl | _bumpMap |
| Path to the Bump/Normal Map. | |
| QUrl | _decalMap |
| Path to the Decal Map. | |
| QUrl | _dispersionMap |
| Path to the Dispersion Map. | |
| std::unordered_map< std::string, qreal > | _scalars |
| Maps to store parsed values before applying them. | |
| std::unordered_map< std::string, QColor > | _colors |
| Maps to store parsed colors before applying them. | |
| std::unordered_map< std::string, QUrl > | _maps |
| Maps to store parsed texture maps before applying them. | |
| std::unordered_map< std::string, std::function< void(const std::string &, const std::string &)> > | _parseFunctions |
| Map of parsing functions for different MTL line prefixes. | |
Class representing a material parsed from an MTL file.
|
explicit |
Constructor.
| parent | Parent QObject, nullptr by default |
References _parseFunctions, parseColor(), parseMap(), and parseScalar().

|
overridedefault |
Destructor.
|
signal |
Signal emitted when the bump map changes.
|
signal |
Signal emitted when the bump strength changes.
|
signal |
Signal emitted when the opacity changes.
|
signal |
Signal emitted when the diffuse map changes.
|
signal |
Signal emitted when the dissolve map changes.
|
signal |
Signal emitted when the emissive map changes.
|
inline |
Get the Ambient Map URL.
References _ambientMap.
|
inline |
Get the Bump/Normal Map URL.
References _bumpMap.
|
inline |
Get the Decal Map URL.
References _decalMap.
|
inline |
Get the Diffuse Map URL.
References _diffuseMap.
|
inline |
Get the Dispersion Map URL.
References _dispersionMap.
|
inline |
Get the Dissolve Map URL.
References _dissolveMap.
|
inline |
Get the Emissive Map URL.
References _emissiveMap.
|
inline |
Get the Specular Map URL.
References _specularMap.
|
inline |
Get the Specular Reflection Map URL.
References _specularReflectionMap.
|
signal |
Signal emitted when the illumination model changes.
|
signal |
Signal emitted when the diffuse color changes.
|
signal |
Signal emitted when the metalness changes.
|
signal |
Signal emitted when the index of refraction changes.
|
signal |
Signal emitted when the specular roughness changes.
|
private |
Parse a color value from an MTL line.
| line | Line to parse |
| key | Key of the color value |
References _colors, and model_viewer::string_helpers::trim_copy().
Referenced by MTLMaterial().


|
private |
Parse a texture map from an MTL line.
| line | Line to parse |
| key | Key of the texture map |
References _maps, _parentPath, and model_viewer::string_helpers::trim_copy().
Referenced by MTLMaterial().


|
private |
Parse the MTL file line by line.
| file | Input file stream to parse |
References _parseFunctions, and model_viewer::string_helpers::trim_copy().
Referenced by parseMTL().


| void model_viewer::material::MTLMaterial::parseMTL | ( | const std::string & | filepath | ) |
Parse an MTL file and set the material properties.
| filepath | Path to the MTL file |
References _parentPath, parseMaterial(), and setMaterialValues().

|
private |
Parse a scalar value from an MTL line.
| line | Line to parse |
| key | Key of the scalar value |
References _scalars, and model_viewer::string_helpers::trim_copy().
Referenced by MTLMaterial().


| void model_viewer::material::MTLMaterial::resetMaterial | ( | ) |
Reset the material to default values.
References _colors, _maps, _scalars, and setMaterialValues().

|
signal |
Signal emitted when the roughness changes.
|
private |
Apply parsed values to the material properties.
References _ambientMap, _bumpMap, _colors, _d, _decalMap, _diffuseMap, _dispersionMap, _dissolveMap, _emissiveMap, _illumination, _Ka, _Kd, _Ke, _Ks, _maps, _metalness, _Ni, _Ns, _roughness, _scalars, _sharpness, _specularMap, _specularReflectionMap, and _Tf.
Referenced by parseMTL(), and resetMaterial().

|
signal |
Signal emitted when the sharpness changes.
|
signal |
Signal emitted when the specular map changes.
|
signal |
Signal emitted when the specular reflection map changes.
|
private |
Path to the Ambient Map.
Referenced by getAmbientMap(), and setMaterialValues().
|
private |
Path to the Bump/Normal Map.
Referenced by getBumpMap(), and setMaterialValues().
|
private |
Bump/Normal Strength.
|
private |
Maps to store parsed colors before applying them.
Referenced by parseColor(), resetMaterial(), and setMaterialValues().
|
private |
Opacity.
Referenced by setMaterialValues().
|
private |
Path to the Decal Map.
Referenced by getDecalMap(), and setMaterialValues().
|
private |
Path to the Diffuse Map.
Referenced by getDiffuseMap(), and setMaterialValues().
|
private |
Path to the Dispersion Map.
Referenced by getDispersionMap(), and setMaterialValues().
|
private |
Path to the Dissolve Map.
Referenced by getDissolveMap(), and setMaterialValues().
|
private |
Path to the Emissive Map.
Referenced by getEmissiveMap(), and setMaterialValues().
|
private |
Illumination Model.
Referenced by setMaterialValues().
|
private |
Ambient Color.
Referenced by setMaterialValues().
|
private |
Diffuse Color.
Referenced by setMaterialValues().
|
private |
Emissive Color.
Referenced by setMaterialValues().
|
private |
Specular Color.
Referenced by setMaterialValues().
|
private |
Maps to store parsed texture maps before applying them.
Referenced by parseMap(), resetMaterial(), and setMaterialValues().
|
private |
Metalness.
Referenced by setMaterialValues().
|
private |
Index of Refraction.
Referenced by setMaterialValues().
|
private |
Specular Roughness.
Referenced by setMaterialValues().
|
private |
Parent path of the MTL file.
Referenced by parseMap(), and parseMTL().
|
private |
Map of parsing functions for different MTL line prefixes.
Referenced by MTLMaterial(), and parseMaterial().
|
private |
Roughness.
Referenced by setMaterialValues().
|
private |
Maps to store parsed values before applying them.
Referenced by parseScalar(), resetMaterial(), and setMaterialValues().
|
private |
Sharpness.
Referenced by setMaterialValues().
|
private |
Path to the Specular Map.
Referenced by getSpecularMap(), and setMaterialValues().
|
private |
Path to the Specular Reflection Map.
Referenced by getSpecularReflectionMap(), and setMaterialValues().
|
private |
Transmission Filter.
Referenced by setMaterialValues().
|
read |
| qreal model_viewer::material::MTLMaterial::bumpStrength |
| QColor model_viewer::material::MTLMaterial::diffuseColor |
|
read |
|
read |
|
read |
| qreal model_viewer::material::MTLMaterial::illumination |
| qreal model_viewer::material::MTLMaterial::indexOfRefraction |
| qreal model_viewer::material::MTLMaterial::metalness |
| qreal model_viewer::material::MTLMaterial::opacity |
| qreal model_viewer::material::MTLMaterial::roughness |
|
read |
|
read |