HammeriteGizmoBuffer
Core: entities. Inherits RefCounted
What the editor is asked to draw over the level for one frame: the shape a tool is dragging out, a selection's wireframe, a marker on the cursor.
Only a record. Something else renders it - the editor, into its perspective and ortho views - so writing to one needs no scene tree, no renderer and no autoload, and what was asked for can be read back. Every call says which Views it belongs in, because the ortho views draw brushes of their own and a wireframe that helps in perspective is a second copy of the outline there.
Properties
| Type | Name | Default |
|---|---|---|
HammeriteGizmoBuffer.Primitives | perspective | <unknown> |
HammeriteGizmoBuffer.Primitives | ortho | <unknown> |
Methods
| Returns | Method |
|---|---|
HammeriteGizmoBuffer | take() |
bool | is_empty() |
void | line(a: Vector3, b: Vector3, color: Color, views: int = 3) |
void | dashed_line(a: Vector3, b: Vector3, color: Color, views: int = 3) |
void | polygon(points: PackedVector3Array, color: Color, views: int = 3, xform: Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)) |
void | box(aabb: AABB, color: Color, views: int = 3) |
void | sphere(centre: Vector3, radius: float, color: Color, views: int = 3) |
void | marker(position: Vector3, color: Color, radius: float = 6.0, filled: bool = true, views: int = 3) |
void | sprite(position: Vector3, texture: Texture2D, size: float, tint: Color = Color(1, 1, 1, 1), views: int = 3) |
void | label(position: Vector3, text: String, views: int = 3) |
Enumerations
enum View
| Value | Name | Description |
|---|---|---|
1 | PERSPECTIVE | The 3D perspective view. |
2 | ORTHO | The three orthographic views. |
3 | ALL | Every view. |
Constants
CIRCLE_SEGMENTS
const CIRCLE_SEGMENTS = 32
How many lines each of a sphere()'s great circles is drawn with in perspective.
BOX_EDGES
const BOX_EDGES = PackedInt32Array(0, 1, 2, 3, 4, 5, 6, 7, 0, 2, 1, 3, 4, 6, 5, 7, 0, 4, 1, 5, 2, 6, 3, 7)
A box's twelve edges, as the ends AABB.get_endpoint() numbers - x the 4s bit, y the 2s and z the 1s.
Property descriptions
perspective
var perspective: HammeriteGizmoBuffer.Primitives = <unknown>
What has been recorded for the perspective view. Read by the renderer; draw through the methods.
ortho
var ortho: HammeriteGizmoBuffer.Primitives = <unknown>
What has been recorded for the ortho views. Read by the renderer; draw through the methods.
Method descriptions
take()
func take() -> HammeriteGizmoBuffer
Everything drawn so far, in a buffer of its own, leaving this one empty for the next frame. The renderer's, as perspective and ortho are.
is_empty()
func is_empty() -> bool
Whether nothing has been recorded for any view.
line()
func line(a: Vector3, b: Vector3, color: Color, views: int = 3) -> void
A straight line between world-space points a and b.
dashed_line()
func dashed_line(a: Vector3, b: Vector3, color: Color, views: int = 3) -> void
Dashed where a view can space the dashes on screen, which is the ortho views; solid in perspective.
polygon()
func polygon(points: PackedVector3Array, color: Color, views: int = 3, xform: Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)) -> void
A closed outline through points, each moved by xform.
box()
func box(aabb: AABB, color: Color, views: int = 3) -> void
The twelve edges of aabb, in world space.
sphere()
func sphere(centre: Vector3, radius: float, color: Color, views: int = 3) -> void
Three great circles in perspective, one circle in the ortho views: a reach shown rather than filled in, so the room it is read against stays visible.
marker()
func marker(position: Vector3, color: Color, radius: float = 6.0, filled: bool = true, views: int = 3) -> void
A dot the same size on screen however far away it is: the cursor, a point being placed. radius is in pixels.
sprite()
func sprite(position: Vector3, texture: Texture2D, size: float, tint: Color = Color(1, 1, 1, 1), views: int = 3) -> void
A picture facing the viewer. size is its height the way each view measures a handle: world units in perspective, where it is picked by a world-sized radius, and pixels in the ortho views.
label()
func label(position: Vector3, text: String, views: int = 3) -> void
text drawn at world-space position.
class Primitives
What one kind of view is to draw: the renderer's side, which an entity drawing its gizmos never needs. Line colours are per vertex, so a renderer can hand the arrays to a mesh as they are.
Properties
| Type | Name | Default |
|---|---|---|
PackedVector3Array | line_points | PackedVector3Array() |
PackedColorArray | line_colors | PackedColorArray() |
PackedVector3Array | dashed_points | PackedVector3Array() |
PackedColorArray | dashed_colors | PackedColorArray() |
PackedVector3Array | circle_centres | PackedVector3Array() |
PackedFloat32Array | circle_radii | PackedFloat32Array() |
PackedColorArray | circle_colors | PackedColorArray() |
PackedVector3Array | marker_positions | PackedVector3Array() |
PackedFloat32Array | marker_radii | PackedFloat32Array() |
PackedColorArray | marker_colors | PackedColorArray() |
PackedByteArray | marker_filled | PackedByteArray() |
PackedVector3Array | sprite_positions | PackedVector3Array() |
PackedFloat32Array | sprite_sizes | PackedFloat32Array() |
PackedColorArray | sprite_tints | PackedColorArray() |
Texture2D[] | sprite_textures | [] |
PackedVector3Array | label_positions | PackedVector3Array() |
PackedStringArray | label_texts | PackedStringArray() |
Methods
| Returns | Method |
|---|---|
bool | is_empty() |
Property descriptions
line_points
var line_points: PackedVector3Array = PackedVector3Array()
Pairs of world-space ends, one pair per line.
line_colors
var line_colors: PackedColorArray = PackedColorArray()
One colour per entry of line_points.
dashed_points
var dashed_points: PackedVector3Array = PackedVector3Array()
Pairs of world-space ends, as line_points; ortho views only.
dashed_colors
var dashed_colors: PackedColorArray = PackedColorArray()
One colour per entry of dashed_points.
circle_centres
var circle_centres: PackedVector3Array = PackedVector3Array()
World-sized circles in the plane of the view. Only the ortho views hold these; in perspective a sphere is lines.
circle_radii
var circle_radii: PackedFloat32Array = PackedFloat32Array()
In world units, one per entry of circle_centres.
circle_colors
var circle_colors: PackedColorArray = PackedColorArray()
One per entry of circle_centres.
marker_positions
var marker_positions: PackedVector3Array = PackedVector3Array()
World-space centres of HammeriteGizmoBuffer.marker() dots.
marker_radii
var marker_radii: PackedFloat32Array = PackedFloat32Array()
In pixels, one per marker.
marker_colors
var marker_colors: PackedColorArray = PackedColorArray()
One per marker.
marker_filled
var marker_filled: PackedByteArray = PackedByteArray()
1 for a filled dot, 0 for an outline, one per marker.
sprite_positions
var sprite_positions: PackedVector3Array = PackedVector3Array()
World-space centres of HammeriteGizmoBuffer.sprite() pictures.
sprite_sizes
var sprite_sizes: PackedFloat32Array = PackedFloat32Array()
Heights as HammeriteGizmoBuffer.sprite() takes them: world units in perspective, pixels in ortho. One per sprite.
sprite_tints
var sprite_tints: PackedColorArray = PackedColorArray()
One per sprite.
sprite_textures
var sprite_textures: Texture2D[] = []
One per sprite.
label_positions
var label_positions: PackedVector3Array = PackedVector3Array()
World-space anchors of HammeriteGizmoBuffer.label() texts.
label_texts
var label_texts: PackedStringArray = PackedStringArray()
One per entry of label_positions.
Method descriptions
is_empty()
func is_empty() -> bool
Whether nothing at all has been recorded here.