GPU Primitives - absoluteAquarian/GraphicsLib GitHub Wiki
GPU primitives consist of points, lines and triangles, although this mod doesn't support drawing points (yet).
In the GraphicsLib mod, all Vector2s are screen coordinates, so keep that in mind.
GPU primitives drawing is handled by the GraphicsLib.Primitives.PrimitivesDrawing class.
For user convenience, the Vector2s in the PrimitiveDrawing methods are in world coordinates.
Draws a continuous set of lines connected end-to-end with a single color.
Exceptions:
-
pointsisnull -
pointshas less than two points defined
Draws a continuous set of lines connected end-to-end whose colors blend from start to end over the length of the entire line strip.
Exceptions:
-
pointsisnull -
pointshas less than two points defined
Draws a continuous set of lines connected end-to-end where the color colors[X] blends to colors[X + 1].
Each point in points corresponds with a color in colors.
Exceptions:
-
pointsisnull -
colorsisnull - The length of
pointsisn't equal to the length ofcolors -
pointshas less than two points defined
Draws a set of separated lines where all lines share the same color.
Each line uses a pair of points in points, points[X] and points[X + 1].
Exceptions:
-
pointsisnull -
pointshas an odd number of points defined - The length of
pointsisn't a multiple of two -
pointshas less than two points defined
Draws a set of separated lines where the colors lerp blend point to point.
Each line uses a pair of points in points, points[X] and points[X + 1], and the color colors[X] blends to colors[X + 1].
Exceptions:
-
pointsisnull -
colorsisnull - The length of
pointsisn't a multiple of two - The length of
pointsisn't equal to the length ofcolors -
pointshas less than two points defined
Draws a set of solid triangles which all have the same color.
Exceptions:
-
pointsisnull - The length of
pointsisn't a multiple of three -
pointshas less than three points defined
Draws a set of solid triangles which have their own colors.
Each triangle uses a triplet of points in points: points[X], points[X + 1] and points[X + 2].
Each point, points[X] corresponds to a color, colors[X].
The colors of each vertex in a triangle blend toward each other.
Exceptions:
-
pointsisnull -
colorsisnull - The length of
pointsisn't a multiple of three - The length of
pointsisn't equal to the length ofcolors -
pointshas less than three points defined
PrimitiveDrawing.DrawHollowRectangle(Vector2 coordTL, Vector2 coordBR, Color colorTL, Color colorTR, Color colorBL, Color colorBR)
Draws a hollow rectangle where the colors of each vertex blend from one vertex to their adjacent vertices.
Exceptions:
- none
PrimitiveDrawing.DrawFilledRectangle(Vector2 coordTL, Vector2 coordBR, Color colorTL, Color colorTR, Color colorBL, Color colorBR)
Draws a solid rectangle where the colors of each vertex blend from one vertex to their adjacent vertices.
Exceptions:
- none
Draws a hollow circle where the color of the circle is constant across its perimeter.
It's actually a 360-sided polygon, but who can tell the difference?
Exceptions:
- none
Draws a solid circle where the color of the circle is constant across its area.
It's actually a 360-sided polygon, but who can tell the difference?
Exceptions:
- none
Draws a solid circle where the color of the circle blends from color in the center to edge at its perimeter.
It's actually a 360-sided polygon, but who can tell the difference?
Exceptions:
- none
Submits a custom packet of primitives to draw.
Exceptions:
-
packetisnull -
packet.drawsisnull -
packetdoesn't have any primitives queued in it
Converts worldPos and color into a VertexPositionColor that can be used by GraphicsLib.Primitives.PrimitivePacket.