Gizmos
- Namespace: Turian.Engine.Core
- Source File: Gizmos.cs
Immediate-mode gizmo drawing. Lines submitted during a frame are rendered by GizmoRenderSystem as part of the same render pass as the scene. One instance is shared per Scene View (see SceneViewerService.Gizmos). The buffer is cleared at the start of every frame, so anything not redrawn disappears.
Fields
MaxLines (int) = 32_768: The maximum number of line segments that can be recorded per frame.
CircleSegments (int) = 64: Number of segments used to approximate circles and arcs.
Properties
WorldLines
(IReadOnlyListDepthTest == true }.
OverlayLines
(IReadOnlyListDepthTest == false }.
LineCount
(int): Gets the number of lines recorded this frame.
IsOverflow
(bool) { get; set }: Gets a value indicating whether MaxLines was exceeded this frame. When overflow occurs, only the first MaxLines lines are rendered.
Color
(Vector4) { get; set } = new(1f, 1f, 1f, 1f): Gets or sets the color applied to primitives drawn while it is active.
Thickness
(float) { get; set } = 1f: Gets or sets the thickness, in screen pixels, of drawn lines.
Matrix
(Matrix4x4) { get; set } = Matrix4x4.Identity: Gets or sets the world-to-gizmo-space transform applied to every primitive. Defaults to identity (world space); set to a node's transform for local-space drawing.
DepthTest
(bool) { get; set } = true: Gets or sets whether lines recorded while it is set draw against the scene's depth buffer (occluded by geometry; the world pass) or on top of everything (the overlay pass). Defaults to .
Public Methods
Clear
public void Clear()
Clears all lines recorded for the previous frame. Called once per frame before drawing.
DrawLine
public void DrawLine(Vector3 from, Vector3 to)
Draws a line between from and to. The endpoints are transformed by Matrix using the current Color and Thickness.
Parameters:
from(Vector3)to(Vector3)
DrawRay
public void DrawRay(Vector3 from, Vector3 direction)
Draws a ray starting at from pointing along direction.
Parameters:
from(Vector3)direction(Vector3)
DrawWireCube
public void DrawWireCube(Vector3 center, Vector3 size)
Draws a wireframe cuboid centered on center with the given size.
Parameters:
center(Vector3)size(Vector3)
DrawWireCube
public void DrawWireCube(Matrix4x4 cubeMatrix)
Draws a wireframe cuboid aligned to cubeMatrix. The 2×2×2 cube centred on the origin is transformed by Matrix * cubeMatrix.
Parameters:
cubeMatrix(Matrix4x4)
DrawWireSphere
public void DrawWireSphere(Vector3 center, float radius)
Draws a wireframe sphere around center. Three circles are drawn in the X, Y and Z planes of gizmo space for an unambiguous 3D outline.
Parameters:
center(Vector3)radius(float)
DrawCircle
public void DrawCircle(Vector3 center, Vector3 normal, float radius)
Draws a circle in the plane perpendicular to normal, centred on center.
Parameters:
center(Vector3)normal(Vector3)radius(float)
DrawArc
public void DrawArc(Vector3 center, Vector3 normal, Vector3 fromDirection, float angle, float radius)
Draws an arc of angle degrees starting at fromDirection around normal, in the plane perpendicular to normal.
Parameters:
center(Vector3)normal(Vector3)fromDirection(Vector3)angle(float)radius(float)