pub struct DrawLines3dOptions {
    pub vertex_transform: Mat4,
}
Expand description

Renderer for line markers.

In order to support custom like thickness, we render each line segment using 2D quads which are transformed accordingly. Line segments are represented by two 3D points (start and end) and each of them can have different colors to support gradients. In addition, each line segment also gets the point before and the point after, so we can compute the corners correctly. For individual line segments, we don’t need to handle the corner.

Each of the 4 points in the 2D quad is transformed by computing a normal vector multipled by a thickness value.

Roughly an individual line segment looks like: TL - - - .TR | ,.-’ | A/B - - -,.-’ - - C/D | ,.-’ | BL-’ - - - BR Notice that the pairs A/B and C/D are duplicated. We can use that to avoid doing extra calculation for corners (since individual line segments don’t have corners)

Line segments in a strip looks like: TL - - - .TR | ,.-’ | A - - B - - -,.-’ - - C - - D | ,.-’ | BL-’ - - - BR

Corner points are computed based on the values of the 2D position (i.e. top corner is (0, 1)). When two adjacent segments form an obtuse angle, we draw a miter join: TR/TL. , ’ _/| ’ . , ’ _/ | ’ . , ’ _/ C ’ . , ’ _/ | ’ . TL _/ | ______,––‘TR \ _/ ,BR/BL.––’ / B _/ , ’ ’ . D \ _/ , ’ ’ . / BL’ ’ . BR

But when the angle gets too sharp, we switch to a “fold” join, where the two segments overlap at the corner: ,TR/BL—C–BR/TL , |.__ , . , | . ,_ . , | . , _ . , | , __ . , | , . __ . TL._ | , . .TR ‘B. |, . _.C’ ‘BL BR’

Fields

vertex_transform: Mat4

Custom transformation to do on all vertices

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.