Class PolylineLayer
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
-
objectPolylineLayer
- 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
sharedStorePolylineStore
Fields
Store
Line data this layer draws.
public readonly PolylineStore Store
Field Value
SurfaceLiftPx
Extra lift for world-space segments above the table, in texture px (the same unit as segment WidthPx).
public float SurfaceLiftPx
Field Value
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
pointsIReadOnlyList<LatLon>Vertices in degrees WGS84; at least two.
widthPxfloatStroke width in screen px.
colorColor32Stroke color.
dashPeriodPxfloatDash plus gap length in screen px; 0 draws solid.
Returns
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
maxPointsintMost vertices one SetPositions call will ever carry; at least 2.
widthPxfloatStroke width in screen px.
colorColor32Stroke color.
dashPeriodPxfloatDash plus gap length in screen px; 0 draws solid.
Returns
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
cbCommandBufferCommand 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
viewMapViewTransformCurrent 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
linePolylineHandleHandle 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
viewMapViewTransformCurrent 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
viewMapViewTransformThe surface's own view (pitch 0).
uvMapSurfaceUvMapUV parameterisation of the table mesh.
planeTransformThe table transform lines stand above; positions and width follow it every frame, so a moving table carries its lines rigidly.
planeRendererRendererRenderer 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)