class ShapeMeshes2D

Helper class for easily creating common 2D shapes.

Public

Methods

staticSolidQuad

static void SolidQuad(const Area2 &area, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a quad (2 triangles).

area
Area in which to draw the quad.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelLine

static void PixelLine(const Vector2 &a, const Vector2 &b, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a per-pixel line.

a
Start point of the line.
b
End point of the line.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticQuadLine

static void QuadLine(const Vector2 &a, const Vector2 &b, float width, float border, const Color &color, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a line of specific width as a quad.

a
Start point of the line.
b
End point of the line.
width
Width of the line.
border
Optional border that will increase the width and the length at both end-points. Useful if you are using some kind of filtering for the line rendering, as the filtered pixels can belong to the border region.
color
Color of the line.
meshData
Mesh data that will be populated by this method.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelLineList

static void PixelLineList(const Vector<Vector2> &linePoints, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing per-pixel lines.

linePoints
A list of start and end points for the lines. Must be a multiple of 2.
meshData
Mesh data that will be populated.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticQuadLineList

static void QuadLineList(const Vector<Vector2> &linePoints, float width, float border, const Color &color, const SPtr<MeshData> &meshData, u32 vertexOffset, u32 indexOffset)

Fills the mesh data with vertices representing a polyline of specific width as a set of quads.

linePoints
A list of start and end points for the lines.
width
Width of the line.
border
Optional border that will increase the width and the length at both end-points. Useful if you are using some kind of filtering for the line rendering, as the filtered pixels can belong to the border region.
color
Color of the line.
meshData
Mesh data that will be populated by this method.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticQuadLineList

static void QuadLineList(const Vector2 *linePoints, u32 numPoints, float width, float border, u8 *outVertices, u32 vertexStride, bool indexed)

Fills the provided buffers with vertices representing a polyline of specific width as a set of quads (triangle list).

linePoints
A list of start and end points for the lines.
numPoints
Number of points in the buffer.
width
Width of the line.
border
Optional border that will increase the width and the length at both end-points. Useful if you are using some kind of filtering for the line rendering, as the filtered pixels can belong to the border region.
outVertices
Pre-allocated buffer for the vertices, of size ((numLines * 2) + 2) * if is true, or (numLines * 6) * if false.
vertexStride
Distance between two vertices in the output buffer. Must be at least sizeof(Vector2).
indexed
If true there will be ((numLines * 2) + 2) vertices generated, assuming an index buffer will be used for rendering. If false then (numLines * 6) vertices will be generated.

Protected

Methods

staticPixelLine

static void PixelLine(const Vector2 &a, const Vector2 &b, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with vertices representing a per-pixel line.

a
Start point of the line.
b
End point of the line.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.

staticPixelSolidPolygon

static void PixelSolidPolygon(const Vector<Vector2> &points, u8 *outVertices, u32 vertexOffset, u32 vertexStride, u32 *outIndices, u32 indexOffset)

Fills the provided buffers with position data and indices representing an inner area of a polygon (basically a normal non-antialiased polygon).

points
Points defining the polygon. First point is assumed to be the start and end point.
outVertices
Output buffer that will store the vertex position data.
vertexOffset
Offset in number of vertices from the start of the buffer to start writing at.
vertexStride
Size of a single vertex, in bytes. (Same for both position and color buffer)
outIndices
Output buffer that will store the index data. Indices are 32bit.
indexOffset
Offset in number of indices from the start of the buffer to start writing at.