PrimitiveBatch Type
Batch renderer for 2D primitive shapes using vertex arrays and
GraphicsDevice.DrawUserPrimitives.
Mirrors raylib's primitive rendering (circles, rings, triangles, lines,
polygons, etc.) on top of MonoGame. The batch accumulates vertices in
managed arrays and flushes them as PrimitiveType groups. This avoids
per-geometry GPU resource allocation; DrawUserPrimitives copies the
current vertex span to the device on flush.
The renderer owns one PrimitiveBatch alongside its SpriteBatch.
State transitions (camera changes, DrawImmediate) flush both batches
before re-entering with updated transform settings.
Constructors
| Constructor |
Description
|
Full Usage:
PrimitiveBatch(graphicsDevice)
Parameters:
GraphicsDevice
Returns: PrimitiveBatch
|
|
Instance members
| Instance member |
Description
|
|
|
|
|
|
|
Full Usage:
this.AddTriangleFan
Parameters:
Vector2[]
-
points[0] is the fan center; points[1..] are the rim vertices
in order. points.Length must be at least 3.
color : Color
-
Vertex color applied to every generated vertex.
?closeLoop : bool
-
When true (default), the last rim vertex is connected back to
points[1], closing the fan into a loop. Use false for open
arcs (e.g. a partial circle sector) where connecting the ends would draw
an unwanted chord across the mouth.
|
Adds a triangle fan by decomposing into a triangle list.
|
|
|
|
Adds a triangle list with the given vertices.
|
|
Begins a batch with the given world/camera transform.
|
Full Usage:
this.End
|
Ends the batch, flushing any remaining vertices. |
Full Usage:
this.Flush
|
Flushes all buffered primitive groups to the GPU. |
Full Usage:
this.LineWidth
|
Gets or sets the default thick-line width used by SetLineWidth. |
|
Changes the blend state applied during flush.
|
|
Replaces the effect used during flush. ValueNone restores the internal BasicEffect.
|
|
Changes the rasterizer state applied during flush.
|
|
Changes the active world/camera transform mid-batch. Flushes pending vertices, updates the transform, then resumes.
|
Mibo