WireCube

Sealed shape drawer that renders wireframe cubes by manually drawing 12 line segments. Contains the nested Cube readonly struct for storing cube parameters. Pre-computes 8 unit-cube vertices at construction time and transforms them per-frame using rotation and size.

Definition

Namespace: Paragon.Core.ShapesDrawer Assembly: Paragon.dll

public sealed class WireCubeDrawer : ShapeDrawer<WireCubeDrawer.Cube>

Inheritance: ShapeDrawer<Cube> → WireCubeDrawer

Methods

Add

Enqueues a wireframe cube for rendering this frame.

public void Add(Vector3 center, Quaternion rotation, Vector3 size, Color color, float thickness = 1f)
Parameter
Type
Default
Description

center

Vector3

Cube center position

rotation

Quaternion

Cube rotation

size

Vector3

Cube dimensions (width, height, depth)

color

Color

Wire color

thickness

float

1f

Line thickness in pixels

Draw

Renders all queued wireframe cubes. Sets lineGeometry, thicknessSpace, and per-cube Thickness, then calls DrawCube() for each entry.

Rendering approach: Draws 12 edges as individual lines in a loop of 4 iterations:

  • 4 bottom-face edges — vertices 0→1→2→3→0 scaled by size.x

  • 4 vertical edges — vertices 0→4, 1→5, 2→6, 3→7 scaled by size.y

  • 4 top-face edges — vertices 4→5→6→7→4 scaled by size.z

Each vertex is rotated by the cube's quaternion and offset from a corner origin (center - rotation * size / 2).

circle-exclamation

Cube Struct

Readonly struct holding all parameters for a single wireframe cube draw call.

Construction

The constructor calls InitializeVertexData() which pre-computes 8 unit-cube vertices (from (0,0,0) to (1,1,1)):

Vertex Index
Position

0

(0, 0, 0)

1

(1, 0, 0)

2

(1, 0, 1)

3

(0, 0, 1)

4

(0, 1, 0)

5

(1, 1, 0)

6

(1, 1, 1)

7

(0, 1, 1)

Common Pitfalls

circle-exclamation

Examples

Direct Usage via ShapesDrawer

Bounds Visualization

See Also

Last updated