Struct CommandBuilder Extends IDisposable

Public

Builder for drawing commands.

You can use this to queue many drawing commands. The commands will be queued for rendering when you call the Dispose method. It is recommended that you use the using statement which automatically calls the Dispose method.

// Create a new CommandBuilder
using (var draw = DrawingManager.GetBuilder()) {
// Use the exact same API as the global Draw class
draw.WireBox(Vector3.zero, Vector3.one);
}

Warning

You must call either Dispose or DiscardAndDispose when you are done with this object to avoid memory leaks.

Inner Types

Holds rendering data for a box.

Holds rendering data for a circle.

Holds rendering data for a circle.

Holds rendering data for a line.

Scope that does nothing.

Holds rendering data for a sphere.

Public Methods

Arc (center, start, end, [color])

Draws an arc between two points.

Arrow (from, to, [up, headSize], [color])

Draws an arrow between two points.

ArrowRelativeSizeHead (from, to, up, headFraction, [color])

Draws an arrow between two points with a head that varies with the length of the arrow.

Arrowhead (center, direction, [up], radius, [color])

Draws an arrowhead at a point.

ArrowheadArc (origin, direction, offset, [width], [color])

Draws an arrowhead centered around a circle.

Bezier (p0, p1, p2, p3, [color])

Draws a cubic bezier curve.

CatmullRom (..., [color])

Draws a...

Circle (center, normal, radius, [color])

Draws a circle.

CircleXY (center, radius, [...])

Draws a circle in the XY plane.

CircleXZ (center, radius, [...])

Draws a circle in the XZ plane.

Cross (position, [size], [color])

Draws a cross.

CrossXY (position, [size], [color])

Draws a cross in the XY plane.

CrossXZ (position, [size], [color])

Draws a cross in the XZ plane.

Discards the contents of this command builder without rendering anything.

Dispose ()

Submits this command builder for rendering.

DisposeAfter (dependency, allowedDelay=…)

Disposes this command builder after the given job has completed.

InLocalSpace (transform)

Scope to draw multiple things relative to a transform object.

InScreenSpace (camera)

Scope to draw multiple things in screen space of a camera.

Label2D (position, text, [...])

Draws a label in 3D space aligned with the camera.

Label3D (position, rotation, text, ..., size, ...)

Draws a label in 3D space.

Line (a, b, [color])

Draws a line between two points.

PlaneWithNormal (center, ..., size, [color])

Draws a plane and a visualization of its normal.

Polyline (points, [cycle], [color])

Draws lines through a sequence of points.

Pops a color from the stack.

Pops a duration scope from the stack.

Pops a line width scope from the stack.

Pops a matrix from the stack.

Preallocate (size)

Pre-allocates the internal buffer to an additional size bytes.

PushColor (color)

Draws everything until the next PopColor with the given color.

PushDuration (duration)

Draws everything until the next PopDuration for a number of seconds.

PushLineWidth (pixels, automaticJoins=true)

Draws all lines until the next PopLineWidth with a given line width in pixels.

PushMatrix (matrix)

Multiply all coordinates until the next PopMatrix with the given matrix.

PushSetMatrix (matrix)

Multiply all coordinates until the next PopMatrix with the given matrix.

Ray (..., [color])

Draws a ray...

SolidArc (center, start, end, [color])

Draws a solid arc between two points.

SolidBox (..., [color])

Draws a solid box.

SolidCircle (center, normal, radius, [color])

Draws a disc.

SolidCircleXY (center, radius, [...])

Draws a disc in the XY plane.

SolidCircleXZ (center, radius, [...])

Draws a disc in the XZ plane.

SolidMesh (...)

Draws a solid mesh...

SolidMeshInternal (mesh, temporary, [color])
SolidPlane (center, ..., size, [color])

Draws a solid plane.

SolidRectangle (rect, [color])

Draws a solid rectangle.

SphereOutline (center, radius, [color])

Draws a circle outline around a sphere.

WireBox (..., [color])

Draws the outline of a box...

WireCapsule (..., radius, [color])

Draws a capsule with a ...

WireCylinder (..., radius, [color])

Draws a cylinder.

WireGrid (center, rotation, cells, totalSize, [color])

Draws a grid of lines.

WireHexagon (center, rotation, radius, [color])

Draws a hexagon outline.

WireMesh (mesh, [color])

Draws a wire mesh.

WirePentagon (center, rotation, radius, [color])

Draws a pentagon outline.

WirePlane (center, ..., size, [color])

Draws a wire plane.

WirePolygon (center, vertices, rotation, radius, [color])

Draws a regular polygon outline.

WireRectangle (..., [color])

Draws a rectangle outline.

WireRectangleXZ (center, size, [color])

Draws a rectangle outline.

WireSphere (position, radius, [color])

Draws a wire sphere.

WireTriangle (..., [color])

Draws a triangle outline.

WithColor (color)

Scope to draw multiple things with the same color.

WithDuration (duration)

Scope to draw multiple things for a longer period of time.

WithLineWidth (pixels, automaticJoins=true)

Scope to draw multiple things with a given line width.

WithMatrix (matrix)

Scope to draw multiple things with an implicit matrix transformation.

Public Static Methods

EvaluateCubicBezier (p0, p1, p2, p3, t)

Returns a point on a cubic bezier curve.

GetSize (buffer)

Public Variables

cameraTargets

Can be set to render specifically to these cameras.

Public

Public Static Variables

XZtoXYPlaneMatrix
Public Static Readonly
XZtoYZPlaneMatrix
Public Static Readonly

Private/Protected Members

Add< T > (value)
AssignMeshData< VertexType > (gizmos, bounds, vertices, triangles, layout)
BufferSize
Private
Build (gizmos, buffers, camera, dependency)
BuildMesh (gizmos, meshes, inputBuffers)

Helper for determining how large a pixel is at a given depth.

Command

Internal rendering command.

Private
CommandBuilder (gizmos, hasher, frameRedrawScope, customRedrawScope, isGizmos, isBuiltInCommandBuilder, sceneModeVersion)
Reserve (additionalSpace)

Ensures the buffer has room for at least N more bytes.

buffer
Private
calculateTangent (normal)

Returns an arbitrary vector which is orthogonal to the given one.

gizmos
Private
threadIndex
Private
uniqueID
Private

Deprecated Members

Pops a persist scope from the stack.

PushPersist (duration)

Draws everything until the next PopPersist for a number of seconds.