Skip to content

RibbonOptions

Immutable value object configuring polyline ribbon mesh generation, corner miters, joint dots, and UV texture transforms.

Overview

RibbonOptions groups ribbon generation parameters (closed loop, miter limit, UV swapping, axis flipping, and circular joint dots) into an immutable structure. It eliminates multi-parameter overload explosions across DrawScope and RenderContext.

Immutability & Modification

Every modifier method returns a new RibbonOptions instance or returns the current instance if the requested value is unchanged. The shared baseline instance is retrieved via RibbonOptions.defaults().

Packed Bitfield & Caching

All configuration flags, quantized miter limit, and joint segment counts are packed into a single 32-bit integer via packed(). This allows zero-allocation cache lookups when caching precomputed ribbon meshes in widgets.

Using Default Options

RibbonOptions basic = RibbonOptions.defaults();
scope.ribbon(texture, points, 10.0f, 32.0f, ColorView.WHITE, basic);

Configuring Vertical Cable UVs and Corner Dots

RibbonOptions cableOptions = RibbonOptions.defaults()
    .swapUv(true)
    .jointDots(true)
    .jointSegments(12)
    .miterLimit(3.0f);
scope.ribbon(cableTexture, wirePoints, 6.0f, 24.0f, ColorView.rgb(0, 220, 255), cableOptions);

API

RibbonOptions::defaults()

defaults()

Returns the shared default ribbon options: open path, default miter limit (4.0), no joint dots, standard UV.

Returns RibbonOptions: The shared default RibbonOptions instance..

RibbonOptions::closed()

closed()

Checks whether the ribbon forms a closed loop.

Returns boolean: true if the contour is closed, connecting end to start..

RibbonOptions::miterLimit()

miterLimit()

Gets the maximum miter length in half-widths of the ribbon.

Returns float: The miter limit, at least 1.0..

RibbonOptions::swapUv()

swapUv()

Checks whether U and V texture coordinates are transposed.

Returns boolean: true if U runs along path and V across width..

RibbonOptions::flipU()

flipU()

Checks whether horizontal U coordinates are inverted.

Returns boolean: true if U is flipped (1 - u)..

RibbonOptions::flipV()

flipV()

Checks whether vertical V coordinates are inverted.

Returns boolean: true if V is flipped (1 - v)..

RibbonOptions::jointDots()

jointDots()

Checks whether circular disks are placed at joints.

Returns boolean: true if joint disks are enabled..

RibbonOptions::jointSegments()

jointSegments()

Gets the segment tessellation count for joint disks.

Returns int: Segment count, or 0 for automatic calculation..

RibbonOptions::packed()

packed()

Returns a compact 32-bit integer encoding all boolean flags, quantized miter limit, and joint segments.

Returns int: Stable 32-bit cache key..

RibbonOptions::closed(boolean)

closed(boolean)

Returns options with the specified closed loop setting.

Parameter Type Description
closed boolean true to connect the last point to the first.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::miterLimit(float)

miterLimit(float)

Returns options with the specified miter limit.

Parameter Type Description
miterLimit float Miter limit in half-widths; values below 1.0 are clamped to 1.0.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::swapUv(boolean)

swapUv(boolean)

Returns options with UV coordinate swapping configured.

Parameter Type Description
swapUv boolean true to transpose U and V coordinates for vertical textures.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::flipU(boolean)

flipU(boolean)

Returns options with horizontal U inversion configured.

Parameter Type Description
flipU boolean true to invert U coordinates.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::flipV(boolean)

flipV(boolean)

Returns options with vertical V inversion configured.

Parameter Type Description
flipV boolean true to invert V coordinates.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::jointDots(boolean)

jointDots(boolean)

Returns options with circular joint disks configured.

Parameter Type Description
jointDots boolean true to render circular disks at path joints.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::jointSegments(int)

jointSegments(int)

Returns options with the specified joint disk tessellation.

Parameter Type Description
jointSegments int Tessellation segments; 0 indicates auto-selection based on radius.

Returns RibbonOptions: A new RibbonOptions instance, or this instance if unchanged..

RibbonOptions::isDefault()

isDefault()

Checks whether this instance matches the default options configuration.

Returns boolean: true if all parameters match defaults..