Table of Contents

Class PolylineLayer

Namespace
LansMap.Lines
Assembly
LansMap.Runtime.dll

GPU polyline tier: every segment of every line in one instanced draw on the same transform as the tiles.

public sealed class PolylineLayer : IDisposable
Inheritance
object
PolylineLayer
Implements

Constructors

PolylineLayer()

Creates a layer that owns a new empty PolylineStore.

public PolylineLayer()

PolylineLayer(PolylineStore)

Shares an existing store - typically another PolylineLayer's - so the same lines render on this layer without copying, and a 2D-to-tabletop (or screen-to-in-texture) switch is a pure view swap. Mirrors SurfaceWorldMarkerRenderer(MarkerStore)'s shared-store intent. Each layer keeps its own uploaded revision, so a layer may skip unchanged frames and consume edits missed by a second layer.

public PolylineLayer(PolylineStore sharedStore)

Parameters

sharedStore PolylineStore

Fields

Store

Line data this layer draws.

public readonly PolylineStore Store

Field Value

PolylineStore

SurfaceLiftPx

Extra lift for world-space segments above the table, in texture px (the same unit as segment WidthPx).

public float SurfaceLiftPx

Field Value

float

Methods

AddPolyline(IReadOnlyList<LatLon>, float, Color32, float)

Adds a ground-level polyline with fixed vertices and returns a handle to it. A caller whose count will vary from call to call uses the AddPolyline(int, float, Color32, float) overload once instead, and calls SetPositions(IReadOnlyList<LatLon>) every frame.

public PolylineHandle AddPolyline(IReadOnlyList<LatLon> points, float widthPx, Color32 color, float dashPeriodPx = 0)

Parameters

points IReadOnlyList<LatLon>

Vertices in degrees WGS84; at least two.

widthPx float

Stroke width in screen px.

color Color32

Stroke color.

dashPeriodPx float

Dash plus gap length in screen px; 0 draws solid.

Returns

PolylineHandle

AddPolyline(int, float, Color32, float)

Reserves a polyline with no vertices yet and returns a handle to it - for a caller whose geometry is recomputed every frame from live state (a sensor's swath boundary, a predictor outline). Invisible until the handle's SetPositions(IReadOnlyList<LatLon>) writes at least two.

public PolylineHandle AddPolyline(int maxPoints, float widthPx, Color32 color, float dashPeriodPx = 0)

Parameters

maxPoints int

Most vertices one SetPositions call will ever carry; at least 2.

widthPx float

Stroke width in screen px.

color Color32

Stroke color.

dashPeriodPx float

Dash plus gap length in screen px; 0 draws solid.

Returns

PolylineHandle

Dispose()

Releases GPU buffers and both draw materials.

public void Dispose()

FillCommandBuffer(CommandBuffer)

Records the prepared polyline draw into cb. The segment buffer binds through a per-draw property block: command buffers do not snapshot material buffer state.

public void FillCommandBuffer(CommandBuffer cb)

Parameters

cb CommandBuffer

Command buffer already bound to the camera target.

PrepareDraw(MapViewTransform)

Uploads dirty segments and stashes uniforms for view. Call from the game thread before FillCommandBuffer(CommandBuffer).

public void PrepareDraw(MapViewTransform view)

Parameters

view MapViewTransform

Current map view.

Remove(PolylineHandle)

Removes a line added through this layer. A stale or default handle is a no-op.

public void Remove(PolylineHandle line)

Parameters

line PolylineHandle

Handle from a successful add on this layer.

Render(MapViewTransform)

Uploads dirty segments if needed and paints them into a ScreenMapView or SurfaceMapView.

public void Render(MapViewTransform view)

Parameters

view MapViewTransform

Current map view.

RenderWorld(MapViewTransform, in SurfaceUvMap, Transform, Renderer)

Submits this frame's world-space draw: the same segments, drawn as camera-facing ribbons standing above a SurfaceMapView's table instead of painted into its render texture. Altitude-aware endpoints through SurfaceMercatorFrame, so a route can never desync from the flat draw sharing this Store. Call once per frame after the surface view is final (LateUpdate).

public void RenderWorld(MapViewTransform view, in SurfaceUvMap uvMap, Transform plane, Renderer planeRenderer)

Parameters

view MapViewTransform

The surface's own view (pitch 0).

uvMap SurfaceUvMap

UV parameterisation of the table mesh.

plane Transform

The table transform lines stand above; positions and width follow it every frame, so a moving table carries its lines rigidly.

planeRenderer Renderer

Renderer whose world bounds anchor the draw's culling bounds, expanded upward by the tallest segment endpoint.

SetFog(float, float, Color)

Sets the horizon fade this layer's flat draw applies, the same SetFog(float, float, Color) shape and units so a route fades into the fog exactly like the tiles under it. Never affects RenderWorld(MapViewTransform, in SurfaceUvMap, Transform, Renderer) - a SurfaceMapView table has no horizon to fade toward.

public void SetFog(float startViewDistance, float endViewDistance, Color color)

Parameters

startViewDistance float

View distance where the fade begins.

endViewDistance float

View distance where the fade completes; at or below startViewDistance switches the fade off.

color Color

Color distant segments fade toward.