Magnum::Shaders::LineMaterialUniform struct new in Git master

Material uniform for line shaders.

Describes material properties referenced from LineDrawUniform::materialId.

Constructors, destructors, conversion operators

LineMaterialUniform(DefaultInitT = DefaultInit) explicit constexpr noexcept
Construct with default parameters.
LineMaterialUniform(NoInitT) explicit noexcept
Construct without initializing the contents.

Public variables

Color4 backgroundColor
Background color.
Color4 color
Color.
Float width
Line width.
Float smoothness
Line smoothness.
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) -> LineMaterialUniform&
Set the color field.
auto setBackgroundColor(const Color4& color) -> LineMaterialUniform&
Set the backgroundColor field.
auto setWidth(Float width) -> LineMaterialUniform&
Set the width field.
auto setSmoothness(Float smoothness) -> LineMaterialUniform&
Set the smoothness field.
auto setMiterLengthLimit(Float limit) -> LineMaterialUniform&
Set the miterLimit field to a length value.
auto setMiterAngleLimit(Rad limit) -> LineMaterialUniform&
Set the miterLimit field to an angle value.

Function documentation

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::setColor(const Color4& color)

Set the color field.

Returns Reference to self (for method chaining)

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::setBackgroundColor(const Color4& color)

Set the backgroundColor field.

Returns Reference to self (for method chaining)

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::setWidth(Float width)

Set the width field.

Returns Reference to self (for method chaining)

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::setSmoothness(Float smoothness)

Set the smoothness field.

Returns Reference to self (for method chaining)

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::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.

LineMaterialUniform& Magnum::Shaders::LineMaterialUniform::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::Shaders::LineMaterialUniform::backgroundColor

Background color.

Default value is 0x00000000_rgbaf. Used for edge smoothing if smoothness is non-zero, and for background areas if LineCapStyle::Round or LineCapStyle::Triangle is used. If smoothness is zero and LineCapStyle::Butt or LineCapStyle::Square is used, only the foreground color is used.

Color4 Magnum::Shaders::LineMaterialUniform::color

Color.

Default value is 0xffffffff_rgbaf.

If LineGL::Flag::VertexColor is enabled, the color is multiplied with a color coming from the LineGL::Color3 / LineGL::Color4 attribute.

Float Magnum::Shaders::LineMaterialUniform::width

Line width.

Screen-space, interpreted depending on the viewport size — i.e., a value of 1.0f is one pixel only if LineGL::setViewportSize() is called with the actual pixel size of the viewport. Default value is 1.0f.

Float Magnum::Shaders::LineMaterialUniform::smoothness

Line smoothness.

Larger values will make edges look less aliased (but blurry), smaller values will make them more crisp (but possibly aliased). Screen-space, interpreted depending on the viewport size — i.e., a value of 1.0f is one pixel only if LineGL::setViewportSize() is called with the actual pixel size of the viewport. Initial value is 0.0f.

Float Magnum::Shaders::LineMaterialUniform::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.