Skip to main content

TextShaderPropertiesOverride Struct

Optional overrides for text shader properties. More...

Declaration

struct helios::rendering::text::TextShaderPropertiesOverride { ... }

Public Member Functions Index

TextShaderPropertiesOverridewithBaseColor (helios::math::vec4f color) noexcept

Creates a new override with the given base color. More...

voidwriteUniformValues (helios::rendering::shader::UniformValueMap &uniformValueMap) const noexcept

Writes override values to a uniform value map. More...

Public Member Attributes Index

std::optional< helios::math::vec4f >baseColor

Optional override for the text color. More...

Description

Optional overrides for text shader properties.

`TextShaderPropertiesOverride` allows individual `TextRenderable` instances to override specific properties defined in the shared `TextShaderProperties`. Only the properties that are set (non-nullopt) will override the base values.

## Design

This pattern allows sharing a common `TextRenderPrototype` while still enabling per-instance customization:

```cpp // Shared prototype with white text auto prototype = std::make_shared<TextRenderPrototype>(shader, textProps, fontProvider);

// Override color for a specific renderable TextShaderPropertiesOverride override; override.baseColor = helios::util::Colors::Red;

TextRenderable highlight(std::move(mesh), prototype, override); ```

See Also

TextShaderProperties

See Also

TextRenderable

Definition at line 45 of file TextShaderPropertiesOverride.ixx.

Public Member Functions

withBaseColor()

TextShaderPropertiesOverride helios::rendering::text::TextShaderPropertiesOverride::withBaseColor (helios::math::vec4f color)
inline nodiscard noexcept

Creates a new override with the given base color.

Parameters
color

The color to set.

Returns

A new TextShaderPropertiesOverride with the color set.

Definition at line 61 of file TextShaderPropertiesOverride.ixx.

63 }

writeUniformValues()

void helios::rendering::text::TextShaderPropertiesOverride::writeUniformValues (helios::rendering::shader::UniformValueMap & uniformValueMap)
inline noexcept

Writes override values to a uniform value map.

Only writes values that are set (non-nullopt). This method should be called after the base `TextShaderProperties::writeUniformValues()` to apply the overrides.

Parameters
uniformValueMap

The uniform value map to write to.

Definition at line 74 of file TextShaderPropertiesOverride.ixx.

74 void writeUniformValues(helios::rendering::shader::UniformValueMap& uniformValueMap) const noexcept {
75
76 if (baseColor) {
78 }
79
80 }

References baseColor and helios::rendering::shader::TextColor.

Public Member Attributes

baseColor

std::optional<helios::math::vec4f> helios::rendering::text::TextShaderPropertiesOverride::baseColor

Optional override for the text color.

When set, this color overrides the base color from `TextShaderProperties`.

Definition at line 52 of file TextShaderPropertiesOverride.ixx.

52 std::optional<helios::math::vec4f> baseColor;

Referenced by writeUniformValues.


The documentation for this struct was generated from the following file:


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.