|
Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
|
CPU-side material description consumed by renderer material upload code. More...
#include <MaterialData.h>
Public Member Functions | |
| MaterialData ()=default | |
| Creates a material with default values and the normals debug pipeline. | |
| MaterialData (Rendering::PipelineNames pipe) | |
| Creates a material for a specific pipeline. | |
| MaterialData (Rendering::PipelineNames pipe, uint32_t baseColorTexIdx, const glm::vec4 &baseColorFac) | |
| Creates a material with a pipeline, base-color texture, and base-color factor. | |
| bool | hasBaseColorTexture () const |
| Checks whether a base-color texture descriptor index is present. | |
| bool | hasNormalTexture () const |
| Checks whether a normal texture descriptor index is present. | |
| bool | hasMetallicRoughnessTexture () const |
| Checks whether a metallic-roughness texture descriptor index is present. | |
| bool | hasEmissiveTexture () const |
| Checks whether an emissive texture descriptor index is present. | |
| bool | hasLightmapTexture () const |
| Checks whether a lightmap texture descriptor index is present. | |
| bool | isAlphaMasked () const |
| Checks whether the material is configured for alpha masking. | |
| MaterialData & | withBaseColorTexture (uint32_t idx) |
| Sets the base-color texture descriptor index. | |
| MaterialData & | withNormalTexture (uint32_t idx) |
| Sets the normal texture descriptor index. | |
| MaterialData & | withMetallicRoughnessTexture (uint32_t idx) |
| Sets the metallic-roughness texture descriptor index. | |
| MaterialData & | withEmissiveTexture (uint32_t idx) |
| Sets the emissive texture descriptor index. | |
| MaterialData & | withLightmapTexture (uint32_t idx) |
| Sets the lightmap texture descriptor index. | |
| MaterialData & | withBaseColorFactor (const glm::vec4 &fac) |
| Sets the linear RGBA base-color multiplier. | |
| MaterialData & | withEmissiveFactor (const glm::vec3 &fac) |
| Sets the linear RGB emissive multiplier. | |
| MaterialData & | withRoughness (float r) |
| Sets the scalar roughness value. | |
| MaterialData & | withMetallic (float m) |
| Sets the scalar metallic value. | |
| MaterialData & | withNormalScale (float s) |
| Sets the normal map scale. | |
| MaterialData & | withShScale (float s) |
| Sets the spherical harmonics lighting multiplier. | |
| MaterialData & | withAmbientTerm (float a) |
| Sets the ambient lighting term. | |
| MaterialData & | withDebugMode (uint32_t d) |
| Sets the material debug mode selector. | |
| MaterialData & | withToneMapping (uint32_t t) |
| Sets the material tone-mapping mode. | |
| MaterialData & | withAlphaCutoff (float cutoff) |
| Sets the alpha-mask cutoff threshold. | |
| MaterialData & | withNormalMapBC5 (bool bc5) |
| Selects BC5/RG normal map decoding. | |
Public Attributes | |
| Rendering::PipelineNames | pipeline = Rendering::PipelineNames::NORMALS_SHADER |
| Graphics pipeline used to interpret this material. | |
| uint32_t | baseColorTextureIndex = 0xFFFFFFFF |
| Base-color texture descriptor index, or 0xFFFFFFFF when absent. | |
| uint32_t | normalTextureIndex = 0xFFFFFFFF |
| Normal texture descriptor index, or 0xFFFFFFFF when absent. | |
| uint32_t | roughnessMetallicTextureIndex = 0xFFFFFFFF |
| Metallic-roughness texture descriptor index, or 0xFFFFFFFF when absent. | |
| uint32_t | emissiveTextureIndex = 0xFFFFFFFF |
| Emissive texture descriptor index, or 0xFFFFFFFF when absent. | |
| uint32_t | lightmapTextureIndex = 0xFFFFFFFF |
| Lightmap texture descriptor index, or 0xFFFFFFFF when absent. | |
| glm::vec4 | baseColorFactor = glm::vec4(1.0f) |
| Linear RGBA base-color multiplier. | |
| glm::vec3 | emissiveFactor = glm::vec3(0.0f) |
| float | roughnessFactor = 1.0f |
| Scalar roughness used when no metallic-roughness texture is present. | |
| float | metallicFactor = 0.0f |
| Scalar metallic value used when no metallic-roughness texture is present. | |
| float | normalScale = 1.0f |
| Scale applied to sampled tangent-space normals. | |
| float | shScale = 1.0f |
| Spherical harmonics lighting multiplier. | |
| float | ambientTerm = 0.0f |
| Ambient lighting term mixed with probe or spherical harmonics lighting. | |
| uint32_t | debugMode = 0 |
| Material debug mode selector. | |
| uint32_t | toneMapping = 1 |
| Material tone-mapping mode: 0=None, 1=Reinhard, 2=ACES. | |
| bool | normalMapBC5 = false |
| True when the normal map stores X and Y in BC5/RG format and reconstructs Z. | |
| float | alphaCutoff = 1.0f |
| Alpha-mask discard threshold. Values below 1.0f mark the material as masked. | |
CPU-side material description consumed by renderer material upload code.
MaterialData stores the pipeline selector, texture descriptor indices, scalar factors, and shader options for one material component. Texture index fields use 0xFFFFFFFF when the texture is absent. When stored on Engine::Assets::Material, texture handles and paths are resolved before these direct descriptor indices are used as fallback values.
The fluent with*() functions mutate the struct and return *this. They do not change the selected pipeline.
Definition at line 22 of file MaterialData.h.
|
default |
Creates a material with default values and the normals debug pipeline.
Referenced by withAlphaCutoff(), withAmbientTerm(), withBaseColorFactor(), withBaseColorTexture(), withDebugMode(), withEmissiveFactor(), withEmissiveTexture(), withLightmapTexture(), withMetallic(), withMetallicRoughnessTexture(), withNormalMapBC5(), withNormalScale(), withNormalTexture(), withRoughness(), withShScale(), and withToneMapping().
|
inlineexplicit |
Creates a material for a specific pipeline.
| pipe | Pipeline used to render the material. |
Definition at line 67 of file MaterialData.h.
References pipeline.
|
inline |
Creates a material with a pipeline, base-color texture, and base-color factor.
| pipe | Pipeline used to render the material. |
| baseColorTexIdx | Base-color texture descriptor index, or 0xFFFFFFFF when absent. |
| baseColorFac | Linear RGBA base-color multiplier. |
Definition at line 76 of file MaterialData.h.
References baseColorFactor, baseColorTextureIndex, and pipeline.
|
inlinenodiscard |
Checks whether a base-color texture descriptor index is present.
Definition at line 85 of file MaterialData.h.
References baseColorTextureIndex.
|
inlinenodiscard |
Checks whether an emissive texture descriptor index is present.
Definition at line 103 of file MaterialData.h.
References emissiveTextureIndex.
|
inlinenodiscard |
Checks whether a lightmap texture descriptor index is present.
Definition at line 109 of file MaterialData.h.
References lightmapTextureIndex.
|
inlinenodiscard |
Checks whether a metallic-roughness texture descriptor index is present.
Definition at line 97 of file MaterialData.h.
References roughnessMetallicTextureIndex.
|
inlinenodiscard |
Checks whether a normal texture descriptor index is present.
Definition at line 91 of file MaterialData.h.
References normalTextureIndex.
|
inlinenodiscard |
Checks whether the material is configured for alpha masking.
Definition at line 115 of file MaterialData.h.
References alphaCutoff.
|
inline |
Sets the alpha-mask cutoff threshold.
| cutoff | Fragment alpha threshold used by alpha-mask pipelines. |
This function does not switch MaterialData::pipeline to an alpha-mask pipeline.
Definition at line 223 of file MaterialData.h.
References alphaCutoff, and MaterialData().
|
inline |
Sets the ambient lighting term.
| a | Ambient term mixed with probe or spherical harmonics lighting. |
Definition at line 199 of file MaterialData.h.
References ambientTerm, and MaterialData().
|
inline |
Sets the linear RGBA base-color multiplier.
| fac | Base-color factor. |
Definition at line 157 of file MaterialData.h.
References baseColorFactor, and MaterialData().
|
inline |
Sets the base-color texture descriptor index.
| idx | Texture descriptor index, or 0xFFFFFFFF to mark the texture absent. |
Definition at line 122 of file MaterialData.h.
References baseColorTextureIndex, and MaterialData().
|
inline |
Sets the material debug mode selector.
| d | Debug mode value consumed by material shaders that read material-level debug state. |
Definition at line 206 of file MaterialData.h.
References debugMode, and MaterialData().
|
inline |
Sets the linear RGB emissive multiplier.
| fac | Emissive factor. |
Definition at line 164 of file MaterialData.h.
References emissiveFactor, and MaterialData().
|
inline |
Sets the emissive texture descriptor index.
| idx | Texture descriptor index, or 0xFFFFFFFF to mark the texture absent. |
Definition at line 143 of file MaterialData.h.
References emissiveTextureIndex, and MaterialData().
|
inline |
Sets the lightmap texture descriptor index.
| idx | Texture descriptor index, or 0xFFFFFFFF to mark the texture absent. |
Definition at line 150 of file MaterialData.h.
References lightmapTextureIndex, and MaterialData().
|
inline |
Sets the scalar metallic value.
| m | Metallic value used when no metallic-roughness texture is present. |
Definition at line 178 of file MaterialData.h.
References MaterialData(), and metallicFactor.
|
inline |
Sets the metallic-roughness texture descriptor index.
| idx | Texture descriptor index, or 0xFFFFFFFF to mark the texture absent. |
Definition at line 136 of file MaterialData.h.
References MaterialData(), and roughnessMetallicTextureIndex.
|
inline |
Selects BC5/RG normal map decoding.
| bc5 | True when the normal map stores X and Y channels only and reconstructs Z in the shader. |
Definition at line 230 of file MaterialData.h.
References MaterialData(), and normalMapBC5.
|
inline |
Sets the normal map scale.
| s | Scale applied to sampled tangent-space normals. |
Definition at line 185 of file MaterialData.h.
References MaterialData(), and normalScale.
|
inline |
Sets the normal texture descriptor index.
| idx | Texture descriptor index, or 0xFFFFFFFF to mark the texture absent. |
Definition at line 129 of file MaterialData.h.
References MaterialData(), and normalTextureIndex.
|
inline |
Sets the scalar roughness value.
| r | Roughness value used when no metallic-roughness texture is present. |
Definition at line 171 of file MaterialData.h.
References MaterialData(), and roughnessFactor.
|
inline |
Sets the spherical harmonics lighting multiplier.
| s | Spherical harmonics scale. |
Definition at line 192 of file MaterialData.h.
References MaterialData(), and shScale.
|
inline |
Sets the material tone-mapping mode.
| t | Tone-mapping mode: 0=None, 1=Reinhard, 2=ACES. |
Definition at line 213 of file MaterialData.h.
References MaterialData(), and toneMapping.
| float Engine::Core::MaterialData::alphaCutoff = 1.0f |
Alpha-mask discard threshold. Values below 1.0f mark the material as masked.
Definition at line 56 of file MaterialData.h.
Referenced by isAlphaMasked(), and withAlphaCutoff().
| float Engine::Core::MaterialData::ambientTerm = 0.0f |
Ambient lighting term mixed with probe or spherical harmonics lighting.
Definition at line 51 of file MaterialData.h.
Referenced by withAmbientTerm().
| glm::vec4 Engine::Core::MaterialData::baseColorFactor = glm::vec4(1.0f) |
Linear RGBA base-color multiplier.
Definition at line 42 of file MaterialData.h.
Referenced by MaterialData(), and withBaseColorFactor().
| uint32_t Engine::Core::MaterialData::baseColorTextureIndex = 0xFFFFFFFF |
Base-color texture descriptor index, or 0xFFFFFFFF when absent.
Definition at line 32 of file MaterialData.h.
Referenced by hasBaseColorTexture(), MaterialData(), and withBaseColorTexture().
| uint32_t Engine::Core::MaterialData::debugMode = 0 |
Material debug mode selector.
Definition at line 52 of file MaterialData.h.
Referenced by withDebugMode().
| glm::vec3 Engine::Core::MaterialData::emissiveFactor = glm::vec3(0.0f) |
Linear RGB emissive multiplier.
Definition at line 43 of file MaterialData.h.
Referenced by withEmissiveFactor().
| uint32_t Engine::Core::MaterialData::emissiveTextureIndex = 0xFFFFFFFF |
Emissive texture descriptor index, or 0xFFFFFFFF when absent.
Definition at line 38 of file MaterialData.h.
Referenced by hasEmissiveTexture(), and withEmissiveTexture().
| uint32_t Engine::Core::MaterialData::lightmapTextureIndex = 0xFFFFFFFF |
Lightmap texture descriptor index, or 0xFFFFFFFF when absent.
Definition at line 40 of file MaterialData.h.
Referenced by hasLightmapTexture(), and withLightmapTexture().
| float Engine::Core::MaterialData::metallicFactor = 0.0f |
Scalar metallic value used when no metallic-roughness texture is present.
Definition at line 47 of file MaterialData.h.
Referenced by withMetallic().
| bool Engine::Core::MaterialData::normalMapBC5 = false |
True when the normal map stores X and Y in BC5/RG format and reconstructs Z.
Definition at line 55 of file MaterialData.h.
Referenced by withNormalMapBC5().
| float Engine::Core::MaterialData::normalScale = 1.0f |
Scale applied to sampled tangent-space normals.
Definition at line 48 of file MaterialData.h.
Referenced by withNormalScale().
| uint32_t Engine::Core::MaterialData::normalTextureIndex = 0xFFFFFFFF |
Normal texture descriptor index, or 0xFFFFFFFF when absent.
Definition at line 34 of file MaterialData.h.
Referenced by hasNormalTexture(), and withNormalTexture().
| Rendering::PipelineNames Engine::Core::MaterialData::pipeline = Rendering::PipelineNames::NORMALS_SHADER |
Graphics pipeline used to interpret this material.
Use a pipeline that matches the fields and textures set on the material. The default renders with the normals debug shader.
Definition at line 29 of file MaterialData.h.
Referenced by MaterialData(), and MaterialData().
| float Engine::Core::MaterialData::roughnessFactor = 1.0f |
Scalar roughness used when no metallic-roughness texture is present.
Definition at line 45 of file MaterialData.h.
Referenced by withRoughness().
| uint32_t Engine::Core::MaterialData::roughnessMetallicTextureIndex = 0xFFFFFFFF |
Metallic-roughness texture descriptor index, or 0xFFFFFFFF when absent.
Definition at line 36 of file MaterialData.h.
Referenced by hasMetallicRoughnessTexture(), and withMetallicRoughnessTexture().
| float Engine::Core::MaterialData::shScale = 1.0f |
Spherical harmonics lighting multiplier.
Definition at line 50 of file MaterialData.h.
Referenced by withShScale().
| uint32_t Engine::Core::MaterialData::toneMapping = 1 |
Material tone-mapping mode: 0=None, 1=Reinhard, 2=ACES.
Definition at line 53 of file MaterialData.h.
Referenced by withToneMapping().