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 |
|---|---|---|
HammeriteGizmoBufferPrimitives | ortho | |
HammeriteGizmoBufferPrimitives | perspective |
Methods
| Returns | Method |
|---|---|
void | box(aabb: AABB, color: Color, views: int = 3) |
PackedInt32Array | box_edges() static |
void | dashed_line(a: Vector3, b: Vector3, color: Color, views: int = 3) |
bool | is_empty() const |
void | label(position: Vector3, text: String, views: int = 3, along: Vector3 = Vector3(0, 0, 0)) |
void | line(a: Vector3, b: Vector3, color: Color, views: int = 3) |
void | marker(position: Vector3, color: Color, radius: float = 6.0, filled: bool = true, 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 | sphere(centre: Vector3, radius: float, color: Color, views: int = 3) |
void | sprite(position: Vector3, texture: Texture2D, size: float, tint: Color = Color(1, 1, 1, 1), views: int = 3) |
HammeriteGizmoBuffer | take() |
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.
Property descriptions
ortho
var ortho: HammeriteGizmoBufferPrimitives
What has been recorded for the ortho views. Read by the renderer; draw through the methods.
perspective
var perspective: HammeriteGizmoBufferPrimitives
What has been recorded for the perspective view. Read by the renderer; draw through the methods.
Method descriptions
box()
func box(aabb: AABB, color: Color, views: int = 3) -> void
The twelve edges of aabb, in world space.
box_edges()
static func box_edges() -> PackedInt32Array
A box's twelve edges, as the ends AABB.get_endpoint() numbers - x the 4s bit, y the 2s and z the 1s. The constant BOX_EDGES before the class was native: a native class's constants can only be integers.
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.
is_empty()
func is_empty() -> bool
Whether nothing has been recorded for any view.
label()
func label(position: Vector3, text: String, views: int = 3, along: Vector3 = Vector3(0, 0, 0)) -> void
text drawn at world-space position. A measurement passes the direction of the line it measures as along, and each view runs the text along that line on screen, so which size belongs to which edge is read off the text itself. An ortho view leaves out a label along the axis it looks down. Leave it zero and the text is drawn level, in every view.
line()
func line(a: Vector3, b: Vector3, color: Color, views: int = 3) -> void
A straight line between world-space points a and b.
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.
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.
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.
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.
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.