|
Visual Computing Library
devel
|
Represents a Physically-Based Rendering (PBR) material. More...
#include <vclib/space/core/material.h>
Public Types | |
| enum class | AlphaMode { ALPHA_OPAQUE , ALPHA_MASK , ALPHA_BLEND } |
| Defines the alpha rendering mode of the material. More... | |
| enum class | TextureType { BASE_COLOR , METALLIC_ROUGHNESS , NORMAL , OCCLUSION , EMISSIVE , COUNT } |
| Defines the types of textures used in the PBR material model. More... | |
Public Member Functions | |
| float & | alphaCutoff () |
| Gets a mutable reference to the alpha cutoff value. | |
| float | alphaCutoff () const |
Gets the alpha cutoff value. This value is used only when the alpha mode is ALPHA_MASK. | |
| AlphaMode & | alphaMode () |
| Gets a mutable reference to the alpha rendering mode. | |
| AlphaMode | alphaMode () const |
| Gets the alpha rendering mode. | |
| Color & | baseColor () |
| Gets a mutable reference to the base color of the material. | |
| const Color & | baseColor () const |
| Gets the base color of the material. This is used as a tint if a base color texture is present. | |
| TextureDescriptor & | baseColorTextureDescriptor () |
| Gets a mutable reference to the texture descriptor for the base color texture. | |
| const TextureDescriptor & | baseColorTextureDescriptor () const |
| Gets the texture descriptor for the base color texture. | |
| void | deserialize (std::istream &is) |
| Deserializes the material's data from an input stream. | |
| bool & | doubleSided () |
| Gets a mutable reference to the double-sided property. | |
| bool | doubleSided () const |
| Checks if the material is double-sided. If true, both front and back faces of polygons with this material should be rendered. | |
| Color & | emissiveColor () |
| Gets a mutable reference to the emissive color of the material. | |
| const Color & | emissiveColor () const |
| Gets the emissive color of the material. This is the color emitted by the material, independent of lighting. | |
| Material () | |
| Default constructor. | |
| float & | metallic () |
| Gets a mutable reference to the metallic factor of the material. | |
| float | metallic () const |
| Gets the metallic factor of the material. | |
| std::string & | name () |
| Gets a mutable reference to the name of the material. | |
| const std::string & | name () const |
| Gets the name of the material. | |
| float & | normalScale () |
| Gets a mutable reference to the normal scale. | |
| float | normalScale () const |
| Gets the scalar multiplier for the normal map. | |
| float & | occlusionStrength () |
| Gets a mutable reference to the occlusion strength. | |
| float | occlusionStrength () const |
| Gets the strength of the ambient occlusion effect. | |
| bool | operator== (const Material &other) const =default |
| Defaulted equality comparison operator. | |
| float & | roughness () |
| Gets a mutable reference to the roughness factor of the material. | |
| float | roughness () const |
| Gets the roughness factor of the material. | |
| void | serialize (std::ostream &os) const |
| Serializes the material's data to an output stream. | |
| TextureDescriptor & | textureDescriptor (TextureType type) |
| Gets a mutable reference to the texture descriptor for a given texture type. | |
| const TextureDescriptor & | textureDescriptor (TextureType type) const |
| Gets the texture descriptor for a given texture type. | |
| TextureDescriptor & | textureDescriptor (uint type) |
| Gets a mutable reference to the texture descriptor for a given texture type index. | |
| const TextureDescriptor & | textureDescriptor (uint type) const |
| Gets the texture descriptor for a given texture type index. | |
Static Public Member Functions | |
| static Image::ColorSpace | textureTypeToColorSpace (TextureType type) |
| Determines the appropriate color space for a given texture type. | |
Static Public Attributes | |
| static const std::array< std::string, toUnderlying(TextureType::COUNT)> | TEXTURE_TYPE_NAMES |
Private Attributes | |
| float | mAlphaCutoff = 0.5f |
| AlphaMode | mAlphaMode = AlphaMode::ALPHA_OPAQUE |
| Color | mBaseColor = Color::White |
| bool | mDoubleSided = false |
| Color | mEmissiveColor = Color::Black |
| float | mMetallic = 0.0f |
| std::string | mName |
| float | mNormalScale = 1.0f |
| float | mOcclusionStrength = 1.0f |
| float | mRoughness = 1.0f |
| std::array< TextureDescriptor, N_TEXTURE_TYPE > | mTextureDescriptors |
Static Private Attributes | |
| static const uint | N_TEXTURE_TYPE |
Represents a Physically-Based Rendering (PBR) material.
This class encapsulates all the properties required to describe a surface for rendering, following the PBR metallic-roughness workflow. It includes base color, metallic and roughness factors, emissive color, and textures. It also handles transparency modes and other rendering-related attributes.
|
strong |
Defines the alpha rendering mode of the material.
|
strong |
Defines the types of textures used in the PBR material model.
|
inline |
|
inline |
Gets a mutable reference to the alpha cutoff value.
|
inline |
Gets the alpha cutoff value. This value is used only when the alpha mode is ALPHA_MASK.
|
inline |
Gets a mutable reference to the alpha rendering mode.
|
inline |
Gets the alpha rendering mode.
|
inline |
Gets a mutable reference to the base color of the material.
Gets the base color of the material. This is used as a tint if a base color texture is present.
|
inline |
Gets a mutable reference to the texture descriptor for the base color texture.
|
inline |
Gets the texture descriptor for the base color texture.
|
inline |
Deserializes the material's data from an input stream.
| [in/out] | is: The input stream to read from. |
|
inline |
Gets a mutable reference to the double-sided property.
|
inline |
Checks if the material is double-sided. If true, both front and back faces of polygons with this material should be rendered.
|
inline |
Gets a mutable reference to the emissive color of the material.
Gets the emissive color of the material. This is the color emitted by the material, independent of lighting.
|
inline |
Gets a mutable reference to the metallic factor of the material.
|
inline |
Gets the metallic factor of the material.
|
inline |
Gets a mutable reference to the name of the material.
|
inline |
Gets the name of the material.
|
inline |
Gets a mutable reference to the normal scale.
|
inline |
Gets the scalar multiplier for the normal map.
|
inline |
Gets a mutable reference to the occlusion strength.
|
inline |
Gets the strength of the ambient occlusion effect.
Defaulted equality comparison operator.
| [in] | other | The material to compare against. |
|
inline |
Gets a mutable reference to the roughness factor of the material.
|
inline |
Gets the roughness factor of the material.
|
inline |
Serializes the material's data to an output stream.
| [in/out] | os: The output stream to write to. |
|
inline |
Gets a mutable reference to the texture descriptor for a given texture type.
| [in] | type | The TextureType enum value. |
|
inline |
Gets the texture descriptor for a given texture type.
| [in] | type | The TextureType enum value. |
|
inline |
Gets a mutable reference to the texture descriptor for a given texture type index.
| [in] | type | The integer index of the texture type. Must be less than TextureType::COUNT. |
|
inline |
Gets the texture descriptor for a given texture type index.
| [in] | type | The integer index of the texture type. Must be less than TextureType::COUNT. |
|
inlinestatic |
Determines the appropriate color space for a given texture type.
Base color and emissive textures contain color information and should be treated as sRGB. Other textures (metallic-roughness, normal, occlusion) contain data and should be treated as linear.
| [in] | type | The texture type. |
|
inlinestaticprivate |
|
inlinestatic |