Skip to main content

TextShaderProperties.ixx File

Defines shader properties for text rendering. More...

Included Headers

#include <memory> #include <string> #include <utility> #include <helios.rendering.shader.UniformSemantics> #include <helios.rendering.shader.UniformValueMap> #include <helios.math> #include <helios.util.Colors> #include <helios.engine.modules.ui.widgets.types.FontId> #include <helios.rendering.shader.Shader>

Namespaces Index

namespacehelios
namespacerendering

Graphics rendering infrastructure. More...

namespacetext

Text rendering abstractions and data types. More...

Classes Index

classTextShaderProperties

Immutable shader properties for text rendering. More...

Description

Defines shader properties for text rendering.

File Listing

The file content with the documentation metadata removed is:

1/**
2 * @file TextShaderProperties.ixx
3 * @brief Defines shader properties for text rendering.
4 */
5module;
6
7#include <memory>
8#include <string>
9#include <utility>
10
11export module helios.rendering.text.TextShaderProperties;
12
13import helios.rendering.shader.Shader;
14import helios.engine.modules.ui.widgets.types.FontId;
15
16import helios.util.Colors;
17import helios.math;
18
19import helios.rendering.shader.UniformValueMap;
20import helios.rendering.shader.UniformSemantics;
21
22export namespace helios::rendering::text {
23
24 /**
25 * @brief Immutable shader properties for text rendering.
26 *
27 * `TextShaderProperties` defines the base visual properties for rendering text,
28 * such as the text color. These properties are typically shared across multiple
29 * `TextRenderable` instances via a `TextRenderPrototype`.
30 *
31 * ## Usage
32 *
33 * ```cpp
34 * // Create text properties with a custom color
35 * auto textProps = std::make_shared<TextShaderProperties>(
36 * helios::util::Colors::Red
37 * );
38 *
39 * // Use with a render prototype
40 * auto prototype = std::make_shared<TextRenderPrototype>(shader, textProps, fontProvider);
41 * ```
42 *
43 * @see TextRenderPrototype
44 * @see TextShaderPropertiesOverride
45 * @see UniformSemantics::TextColor
46 */
47 class TextShaderProperties final {
48
49 private:
50
51 /**
52 * @brief Base text color (RGBA).
53 */
54 helios::math::vec4f baseColor_;
55
56 public:
57
58 /**
59 * @brief Constructs TextShaderProperties with the specified color.
60 *
61 * @param baseColor The text color. Defaults to white.
62 */
65
66 ) : baseColor_(baseColor) {}
67
68 /**
69 * @brief Writes the text shader properties to a uniform value map.
70 *
71 * Sets the `UniformSemantics::TextColor` uniform to the base color.
72 *
73 * @param uniformValueMap The uniform value map to write to.
74 */
75 void writeUniformValues(helios::rendering::shader::UniformValueMap& uniformValueMap) const noexcept {
76 uniformValueMap.set(helios::rendering::shader::UniformSemantics::TextColor, baseColor_);
77 }
78 };
79
80
81}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.