Class PolygonLayer
public sealed class PolygonLayer : IDisposable
- Inheritance
-
objectPolygonLayer
- Implements
Constructors
PolygonLayer()
public PolygonLayer()
PolygonLayer(PolygonStore)
Shares an existing store - typically another PolygonLayer's - so the same fills render on this layer without copying, and a 2D-to-tabletop (or screen-to-in-texture) switch is a pure view swap. Mirrors PolylineLayer(PolylineStore)'s shared-store handling: PolygonStore has no Version counter, so Store.Dirty (single-consumer - whoever calls ClearDirty first eats it) is not a safe change signal for a second consumer, and Render/RenderWorld instead re-upload every call once anchored. Correct over fast, at the cost of the primary layer's dirty-range skip; fine for switch-and-view usage. A PolygonStore.Version counter would let this match MarkerLayer's cheaper Version-diff path, but PolygonStore.cs is outside this constructor's scope.
public PolygonLayer(PolygonStore sharedStore)
Parameters
sharedStorePolygonStore
Fields
Store
public readonly PolygonStore Store
Field Value
SurfaceLiftPx
public float SurfaceLiftPx
Field Value
Methods
AddPolygon(IReadOnlyList<LatLon>, Color32)
Adds a filled polygon with a fixed ring and returns a handle to it. A caller whose vertex count will vary from call to call uses the AddPolygon(int, Color32) overload once instead, and calls SetPositions(IReadOnlyList<LatLon>) every frame.
public PolygonHandle AddPolygon(IReadOnlyList<LatLon> ring, Color32 fillColor)
Parameters
ringIReadOnlyList<LatLon>Closed outline in degrees WGS84; at least three vertices.
fillColorColor32Fill color.
Returns
Exceptions
- ArgumentException
The ring was refused; see Describe(Rejection).
AddPolygon(int, Color32)
Reserves a polygon with no ring yet and returns a handle to it - for a caller whose ring is recomputed every frame from live state. Invisible until the handle's SetPositions(IReadOnlyList<LatLon>) writes at least three points.
public PolygonHandle AddPolygon(int maxPoints, Color32 fillColor)
Parameters
maxPointsintMost ring vertices one SetPositions call will ever carry; at least 3.
fillColorColor32Fill color.
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FillCommandBuffer(CommandBuffer)
Records the prepared polygon draw into cb. The
triangle 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 triangles and stashes uniforms for view.
Call from the game thread before FillCommandBuffer(CommandBuffer).
public void PrepareDraw(MapViewTransform view)
Parameters
viewMapViewTransformCurrent map view.
Remove(PolygonHandle)
Removes a polygon added through this layer. A stale or default handle is a no-op.
public void Remove(PolygonHandle polygon)
Parameters
polygonPolygonHandleHandle from a successful add on this layer.
Render(MapViewTransform)
public void Render(MapViewTransform view)
Parameters
viewMapViewTransform
RenderWorld(MapViewTransform, in SurfaceUvMap, Transform, Renderer)
Submits this frame's world-space draw: the same triangles, drawn as real 3D geometry standing above a SurfaceMapView's table instead of painted into its render texture, through SurfaceMercatorFrame so a fill 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 fills stand above; positions follow it every frame, so a moving table carries its fills rigidly.
planeRendererRendererRenderer whose world bounds anchor the draw's culling bounds, expanded by the constant drape lift.
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 fill 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)