Type:LineGraphMesh
More actions
LineGraphMesh is a RectMeshSource that draws a line graph of a list of float values inside a rectangle. It is used as the Mesh member of a StandaloneRectMesh (or any other component that hosts a RectMeshSource), which supplies the rectangle.
The values are spaced evenly from the left edge to the right edge of the rectangle. Each value is mapped to a height between the bottom and top edge: MinValue lands on the bottom edge and MaxValue on the top edge. Values outside that range are not clamped, so the line leaves the rectangle. At least two values are needed, with fewer the mesh is empty. If MinValue and MaxValue are equal the line is drawn flat along the bottom edge.
The values are treated as a ring buffer: the first point drawn is Values[StartIndex] and the line wraps around the end of the array. Advance StartIndex by one per new sample to scroll a live graph without moving the other values.
Fields
| Name | Type | Default | Description |
|---|---|---|---|
| MinValue | Float | 0 | The value drawn on the bottom edge of the rectangle. |
| MaxValue | Float | 1 | The value drawn on the top edge of the rectangle. |
| Width | Float | 0.2 | Thickness of the line. The slider range is 0.001 to 4. |
| Color | ColorX | White | Vertex color of the line. |
| UVScale | Float2 | (1, 1) | Scale of the UV coordinates along and across the line. |
| StartIndex | Int | 0 | Index of the value drawn first (at the left edge). Wrapped into the range of the array. |
| Values | Array of Float | empty | The values to graph. One point is drawn per value. |