Magnum::Ui::LineLayerStyleUniform struct new in Git master

LineLayer style uniform

See the LineLayer class documentation for information about setting up an instance of the line layer and using it.

Instances of this class together with LineLayerCommonStyleUniform contain style properties that are used by the LineLayer shaders to draw the layer data, packed in a form that allows direct usage in uniform buffers. Total count of styles is specified with the LineLayer::Shared::Configuration::Configuration() constructor, uniforms are then uploaded using LineLayer::Shared::setStyle(), style data that aren't used by the shader are passed to the function separately.

Constructors, destructors, conversion operators

LineLayerStyleUniform(DefaultInitT = DefaultInit) explicit constexpr noexcept
Construct with default values.
LineLayerStyleUniform(const Color4& color, Float width, Float smoothness, Float miterLimit) constexpr noexcept
Constructor.
LineLayerStyleUniform(NoInitT) explicit noexcept
Construct without initializing the contents.

Public variables

Color4 color
Line color.
Float width
Line width.
Float smoothness
Edge smoothness radius.
Float miterLimit
Miter limit.

Convenience setters

Provided to allow the use of method chaining for populating a structure in a single expression, otherwise equivalent to accessing the fields directly. Also guaranteed to provide backwards compatibility when packing of the actual fields changes.

auto setColor(const Color4& color) -> LineLayerStyleUniform& constexpr
Set the color field.
auto setWidth(Float width) -> LineLayerStyleUniform& constexpr
Set the width field.
auto setSmoothness(Float smoothness) -> LineLayerStyleUniform& constexpr
Set the smoothness field.
auto setMiterLimit(Float limit) -> LineLayerStyleUniform& constexpr
Set the miterLimit field.
auto setMiterLengthLimit(Float limit) -> LineLayerStyleUniform&
Set the miterLimit field to a length value.
auto setMiterAngleLimit(Rad limit) -> LineLayerStyleUniform&
Set the miterLimit field to an angle value.

Function documentation

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setColor(const Color4& color) constexpr

Set the color field.

Returns Reference to self (for method chaining)

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setWidth(Float width) constexpr

Set the width field.

Returns Reference to self (for method chaining)

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setSmoothness(Float smoothness) constexpr

Set the smoothness field.

Returns Reference to self (for method chaining)

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setMiterLimit(Float limit) constexpr

Set the miterLimit field.

Returns Reference to self (for method chaining)

For convenience it's recommended to use the setMiterLengthLimit() and setMiterAngleLimit() helpers instead of setting this value directly.

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setMiterLengthLimit(Float limit)

Set the miterLimit field to a length value.

Returns Reference to self (for method chaining)

Expects that limit is greater than or equal to 1.0f and finite.

LineLayerStyleUniform& Magnum::Ui::LineLayerStyleUniform::setMiterAngleLimit(Rad limit)

Set the miterLimit field to an angle value.

Returns Reference to self (for method chaining)

Expects that limit is greater than 0.0_radf.

Variable documentation

Color4 Magnum::Ui::LineLayerStyleUniform::color

Line color.

Default value is 0xffffffff_srgbaf. The color is further multiplied with per-data value supplied with LineLayer::setColor(), color specified for individual points in LineLayer::create(), setLine() and overloads, and with node opacity coming from AbstractUserInterface::setNodeOpacity().

Float Magnum::Ui::LineLayerStyleUniform::width

Line width.

Default value is 1.0f.

Float Magnum::Ui::LineLayerStyleUniform::smoothness

Edge smoothness radius.

Compared to LineLayerCommonStyleUniform::smoothness is in UI units instead of pixels. Default is 0.0f. Of the two, the larger value in pixels gets used.

Float Magnum::Ui::LineLayerStyleUniform::miterLimit

Miter limit.

Limit at which a LineJoinStyle::Miter join is converted to a LineJoinStyle::Bevel in order to avoid sharp corners extending too much. If joint style is not LineJoinStyle::Miter, this value is unused.

Represented as a cosine of the angle between two neighboring line segments, with LineJoinStyle::Bevel used for angles below the limit (thus their cosine larger than this value). For length-based limits, the relation between angle $ \theta $ , miter length $ l $ and line half-width $ w $ is as follows:

\[ \frac{w}{l} = \sin(\frac{\theta}{2}) \]

For convenience it's recommended to use the setMiterLengthLimit() and setMiterAngleLimit() helpers instead of setting this value directly. Default value is 0.875f, which corresponds to a length of 4.0f and angle of approximately 28.955_degf.