Skip to main content

MaterialShaderProperties.ixx File

Default material properties used by materials and instances. More...

Included Headers

Namespaces Index

namespacehelios
namespacerendering

Graphics rendering infrastructure. More...

namespacematerial

Classes Index

classMaterialShaderProperties

Represents a Value Object for an immutable set of material properties. More...

Description

Default material properties used by materials and instances.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file MaterialShaderProperties.ixx
3 * @brief Default material properties used by materials and instances.
4 */
5module;
6
7export module helios.rendering.material.MaterialShaderProperties;
8
9import helios.rendering.material.MaterialShaderPropertiesOverride;
10
11import helios.math.types;
12import helios.rendering.shader.UniformValueMap;
13import helios.rendering.shader.UniformSemantics;
14
15export namespace helios::rendering::material {
16
17 /**
18 * @brief Represents a Value Object for an immutable set of material properties.
19 *
20 * This class acts as a Value Object, encapsulating fundamental material characteristics
21 * like base color and roughness. Once an instance is created, its properties cannot
22 * be changed. Methods prefixed with `with*` facilitate functional updates by returning a
23 * **new** MaterialShaderProperties instance with the specified property modified, leaving the
24 * original object - which may still be in use by existing Renderables - untouched.
25 *
26 */
28
29 private:
30 /**
31 * @brief Base color for the material.
32 *
33 * This value typically represents the diffuse color and includes an alpha
34 * component for potential transparency.
35 *
36 * @see https://docs.omniverse.nvidia.com/materials-and-rendering/latest/templates/parameters/OmniPBR_Albedo.html
37 */
38 const helios::math::vec4f baseColor_ = {1.0f, 1.0f, 1.0f, 1.0f};
39
40 /**
41 * @brief The roughness factor of the material.
42 *
43 * This value determines the microfacet distribution of the surface, influencing how light is reflected.
44 * A value of 0 represents a perfectly smooth, mirror-like surface. Conversely, 1 represents a
45 * completely rough, matte surface.
46 *
47 * @see [573-575, PJH23]
48 */
49 const float roughness_ = 0.0f;
50
51
52
53 public:
54 /**
55 * @brief Default destructor for MaterialShaderProperties.
56 */
58
59 /**
60 * @brief Default constructor for MaterialShaderProperties.
61 *
62 * initializes all properties to their default values.
63 */
65
66 /**
67 * @brief Constructs a MaterialShaderProperties instance with the specified values.
68 *
69 * @param baseColor The initial base color for this MaterialShaderProperties instance.
70 * @param roughness The initial roughness factor for the material, which defaults to 0.0f.
71 */
73 helios::math::vec4f baseColor,
74 float roughness = 0.0f
75 ) noexcept : baseColor_(baseColor), roughness_(roughness){}
76
77
78 /**
79 * Creates a new MaterialShaderProperties instance with an updated base color.
80 *
81 * This method returns a new MaterialShaderProperties instance where only the base color has been changed to the
82 * provided value.
83 *
84 * @param baseColor The new base color for the material.
85 *
86 * @return A new immutable instance of MaterialShaderProperties with the updated base color.
87 */
88 [[nodiscard]] MaterialShaderProperties withBaseColor(helios::math::vec4f baseColor) const noexcept {
90 baseColor,
91 roughness_
92 );
93 }
94
95 /**
96 * Creates a new MaterialShaderPropertiesOverride instance with an updated base color.
97 *
98 * This method returns a new MaterialShaderPropertiesOverride instance where only the base
99 * color has been changed to the provided value.
100 *
101 * @param baseColor The new base color for the material.
102 *
103 * @return A new instance of MaterialShaderPropertiesOvrride with the updated base color.
104 */
107 baseColor,
108 roughness_
109 );
110 }
111
112 /**
113 * Creates a new MaterialShaderProperties instance with an updated roughness factor.
114 *
115 * This method returns a new MaterialShaderProperties instance where only the roughness factor has been changed to the
116 * provided value.
117 *
118 * @param roughness The new roughness factor for the material.
119 *
120 * @return A new immutable instance of MaterialShaderProperties with the updated roughness factor.
121 */
122 [[nodiscard]] MaterialShaderProperties withRoughness(float roughness) const noexcept {
124 baseColor_,
125 roughness
126 );
127 }
128
129
130 /**
131 * @brief Writes the current properties into the given UniformValueMap.
132 *
133 * @param uniformValueMap Target map receiving the uniform values.
134 */
135 void writeUniformValues(shader::UniformValueMap& uniformValueMap) const noexcept {
138 }
139
140 };
141}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.