Skip to content

TopologyAdapter

ClassChartGuruChartGuru
public class TopologyAdapter : IChartDrawSink

Decorator over an ChartGuru.IChartDrawSink that only natively accepts ChartGuru.DrawTopology.Triangles and synthesizes the other topologies by buffering the incoming vertex stream per batch and converting on ChartGuru.TopologyAdapter.End.

  • `ChartGuru.DrawTopology.Quads` → two triangles per 4-vertex group (0,1,2) + (0,2,3).
  • `ChartGuru.DrawTopology.Lines` → `ChartGuru.LineTessellator.TessellateLines(System.Collections.Generic.IReadOnlyList%7bUnityEngine.Vector2%7d%2cSystem.Single%2cSystem.Collections.Generic.List%7bUnityEngine.Vector2%7d)` with the configured `ChartGuru.TopologyAdapter.LineWidth`.
  • `ChartGuru.DrawTopology.LineStrip` → `ChartGuru.LineTessellator.TessellatePolyline(System.Collections.Generic.IReadOnlyList%7bUnityEngine.Vector2%7d%2cSystem.Single%2cSystem.Boolean%2cSystem.Collections.Generic.List%7bUnityEngine.Vector2%7d)`.

The adapter buffers color per vertex so per-vertex gradients survive the topology conversion. Colors are replayed into the underlying sink between vertices.

public float LineWidth { get; set; }

Stroke width used when flattening ChartGuru.DrawTopology.Lines/ChartGuru.DrawTopology.LineStrip.

Returns

System.Single — No return description is available.

public TopologyAdapter(IChartDrawSink inner)

No description is available for this member.

Parameters

Name Type Description
inner ChartGuru.IChartDrawSink

public void Begin(DrawTopology topology, DrawMaterial material = DrawMaterial.Standard)

Begins a primitive batch with the given topology and material bucket. Must be balanced with ChartGuru.IChartDrawSink.End before another ChartGuru.IChartDrawSink.Begin(ChartGuru.DrawTopology%2cChartGuru.DrawMaterial).

Parameters

Name Type Description
topology ChartGuru.DrawTopology
material ChartGuru.DrawMaterial
public void Color(Color c)

Sets the current vertex color. Applies to all subsequently emitted vertices until overridden.

Parameters

Name Type Description
c UnityEngine.Color
public void Vertex(float x, float y)

Emits a vertex at the specified chart-space pixel coordinate (Y up, bottom-left origin).

Parameters

Name Type Description
x System.Single
y System.Single
public void End()

Closes the current primitive batch started by ChartGuru.IChartDrawSink.Begin(ChartGuru.DrawTopology%2cChartGuru.DrawMaterial).

public void SetScissor(Rect? clipRectPixels)

Sets an axis-aligned scissor rectangle in pixel coordinates, or clears it when null. Intended for morph and inset panels; the GL sink translates this to an SRP scissor, the UI Toolkit sink to a clipping descendant or manual CPU-side clipping.

Parameters

Name Type Description
clipRectPixels System.Nullable{UnityEngine.Rect}
public void PushTransform(Matrix4x4 m)

Pushes a transform onto the sink’s matrix stack. Subsequent ChartGuru.IChartDrawSink.Vertex(System.Single%2cSystem.Single) calls are effectively multiplied by the top-of-stack matrix. Matches GL.PushMatrix + GL.MultMatrix(m).

Parameters

Name Type Description
m UnityEngine.Matrix4x4
public void PopTransform()

Pops the top matrix from the sink’s transform stack. Matches GL.PopMatrix.