class Diorite::FrameContext

Overview

Context object passed into scoped frame drawing blocks (DebugDraw.frame { |d| ... }).

Provides convenient access to immediate-mode 2D and 3D drawing operations.

DebugDraw.frame do |d|
  d.line_3d(start_pos, end_pos, Color.new(0, 1, 0))
  d.sphere_3d(center: player.position, radius: 1.5)
  d.circle_2d(Godot::Vector2.new(100, 100), 25.0)
end

Defined in:

diorite/core/dsl.cr

Instance Method Summary

Instance Method Detail

def actor_card_3d(position : Godot::Vector3, title : String, stats : Hash(String, String) | Nil = nil, size : Godot::Vector2 = Godot::Vector2.new(1.2_f32, 0.8_f32), color : Godot::Color = Godot::Color.new(0.2_f32, 0.8_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D actor card billboard with anchor line and optional stats.


[View source]
def arc_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32 = 24, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D circular arc.


[View source]
def arrow_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), head_size : Float32 = 10.0_f32, duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D directional arrow.


[View source]
def arrow_3d(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), head_size : Float32 = 0.25_f32, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D directional arrow with a conical arrowhead.


[View source]
def bar_chart_2d(rect : Godot::Rect2, bars : Array(BarData), horizontal : Bool = false, title : String = "", duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D bar chart or histogram.


[View source]
def bezier_cubic_3d(p0 : Godot::Vector3, p1 : Godot::Vector3, p2 : Godot::Vector3, p3 : Godot::Vector3, segments : Int32 = 32, color : Godot::Color = Godot::Color.new(1.0_f32, 0.8_f32, 0.0_f32, 1.0_f32), show_hull : Bool = true, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D cubic Bézier curve.


[View source]
def billboard_square_3d(center : Godot::Vector3 = Godot::Vector3.new, size : Float32 = 1.0_f32, camera_pos : Godot::Vector3 = Godot::Vector3.new, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil, position : Godot::Vector3 | Nil = nil) #

Draws a camera-facing billboard square.


[View source]
def box_3d(center : Godot::Vector3, size : Godot::Vector3, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), wireframe : Bool = true, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws an axis-aligned 3D bounding box wireframe.


[View source]
def box_cast_3d(from : Godot::Vector3, to : Godot::Vector3, size : Godot::Vector3 = Godot::Vector3.new(1.0_f32, 1.0_f32, 1.0_f32), hit : Bool = false, color : Godot::Color = Godot::Color.new(0.0_f32, 0.9_f32, 1.0_f32, 0.8_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a swept box cast.


[View source]
def camera_frustum_3d(origin : Godot::Vector3, basis : Godot::Basis, fov_deg : Float32 = 75.0_f32, near : Float32 = 0.05_f32, far : Float32 = 10.0_f32, aspect : Float32 = 1.777_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 0.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D camera frustum wireframe.


[View source]
def capsule_2d(p0 : Godot::Vector2, p1 : Godot::Vector2, radius : Float32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), segments : Int32 = 12, duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D stadium capsule.


[View source]
def capsule_3d(center : Godot::Vector3, radius : Float32 = 0.5_f32, height : Float32 = 2.0_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), segments : Int32 = 16, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D capsule wireframe.


[View source]
def capsule_cast_3d(from : Godot::Vector3, to : Godot::Vector3, radius : Float32 = 0.5_f32, height : Float32 = 1.8_f32, hit : Bool = false, color : Godot::Color = Godot::Color.new(0.0_f32, 0.9_f32, 1.0_f32, 0.8_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a swept capsule cast.


[View source]
def catmull_rom_3d(points : Array(Godot::Vector3), segments_per_curve : Int32 = 16, color : Godot::Color = Godot::Color.new(0.4_f32, 0.8_f32, 1.0_f32, 1.0_f32), loop : Bool = false, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D Catmull-Rom spline curve.


[View source]
def channel(channel_name : String, &block : FrameContext -> ) : Void #

Executes a block with all nested drawing commands assigned to channel_name.


[View source]
def circle_2d(center : Godot::Vector2, radius : Float32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), segments : Int32 = 24, duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D circle on the canvas overlay.


[View source]
def circle_3d(center : Godot::Vector3, normal : Godot::Vector3 = Godot::Vector3.new(0, 1, 0), radius : Float32 = 1.0_f32, segments : Int32 = 24, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D planar circle ring.


[View source]
def cone_3d(tip : Godot::Vector3, dir : Godot::Vector3, length : Float32 = 5.0_f32, angle_rad : Float32 = 0.52359877_f32, segments : Int32 = 16, color : Godot::Color = Godot::Color.new(0.2_f32, 0.8_f32, 1.0_f32, 0.8_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D vision cone or spotlight frustum.


[View source]
def cylinder_3d(center : Godot::Vector3, radius : Float32 = 1.0_f32, height : Float32 = 2.0_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), segments : Int32 = 16, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D cylinder wireframe.


[View source]
def gauge_2d(center : Godot::Vector2, radius : Float32, value : Float32, min_val : Float32 = 0.0_f32, max_val : Float32 = 100.0_f32, title : String = "", color : Godot::Color = Godot::Color.new(0.2_f32, 0.8_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D radial gauge.


[View source]
def gauge_3d(center : Godot::Vector3, normal : Godot::Vector3, radius : Float32, value : Float32, min_val : Float32 = 0.0_f32, max_val : Float32 = 100.0_f32, title : String = "", color : Godot::Color = Godot::Color.new(0.2_f32, 0.8_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D radial gauge.


[View source]
def gizmo_3d(origin : Godot::Vector3, basis : Godot::Basis = Godot::Basis.new, size : Float32 = 1.0_f32, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws an RGB coordinate transform gizmo.


[View source]
def grid_3d(origin : Godot::Vector3 = Godot::Vector3.new, size : Godot::Vector2 = Godot::Vector2.new(10.0_f32, 10.0_f32), subdivisions : Int32 = 10, color : Godot::Color = Godot::Color.new(0.6_f32, 0.6_f32, 0.6_f32, 0.5_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil, center : Godot::Vector3 | Nil = nil) #

Draws a 3D ground reference grid.


[View source]
def line_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D line segment.


[View source]
def line_3d(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D line segment between two world positions.


[View source]
def line_arrow_3d(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), head_size : Float32 = 0.25_f32, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a line with a terminal arrow head.


[View source]
def line_path_3d(points : Array(Godot::Vector3), color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a continuous 3D polyline connecting an ordered list of points.


[View source]
def obb_3d(center : Godot::Vector3, size : Godot::Vector3, basis : Godot::Basis, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), wireframe : Bool = true, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws an oriented bounding box (OBB).


[View source]
def path_2d(points : Array(Godot::Vector2), color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a continuous 2D polyline connecting an ordered list of points.


[View source]
def pie_chart_2d(center : Godot::Vector2, radius : Float32, slices : Array(PieSlice), inner_radius : Float32 = 0.0_f32, duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D pie or donut chart.


[View source]
def pie_chart_3d(center : Godot::Vector3, normal : Godot::Vector3, radius : Float32, slices : Array(PieSlice), inner_radius : Float32 = 0.0_f32, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D pie or donut chart.


[View source]
def plane_3d(center : Godot::Vector3, normal : Godot::Vector3 = Godot::Vector3.new(0.0_f32, 1.0_f32, 0.0_f32), size : Godot::Vector2 = Godot::Vector2.new(5.0_f32, 5.0_f32), color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D plane quad.


[View source]
def points_2d(points : Array(Godot::Vector2), size : Float32 = 4.0_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws 2D points on the canvas overlay.


[View source]
def points_3d(points : Array(Godot::Vector3), size : Float32 = 0.1_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws 3D point markers.


[View source]
def pop_transform : Void #

Pops the top 3D coordinate transform from the local transform stack.


[View source]
def position_3d(origin : Godot::Vector3, size : Float32 = 1.0_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3-axis crossing position marker.


[View source]
def push_transform(xform : Godot::Transform3D) : Void #

Pushes a 3D coordinate transform onto the local transform stack.


[View source]
def ray_hit_3d(from : Godot::Vector3 = Godot::Vector3.new, hit_point : Godot::Vector3 = Godot::Vector3.new, normal : Godot::Vector3 = Godot::Vector3.new, color : Godot::Color = Godot::Color.new(0.0_f32, 1.0_f32, 0.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil, origin : Godot::Vector3 | Nil = nil) #

Draws a raycast collision result.


[View source]
def rect_2d(rect : Godot::Rect2, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D wireframe rectangle.


[View source]
def reticle_3d(position : Godot::Vector3, normal : Godot::Vector3 = Godot::Vector3.new(0, 0, 1), size : Float32 = 0.5_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 0.2_f32, 0.2_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D aiming reticle.


[View source]
def ruler_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), tick_step : Float32 = 20.0_f32, tick_size : Float32 = 8.0_f32, duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D calibrated measuring ruler.


[View source]
def ruler_3d(from : Godot::Vector3, to : Godot::Vector3, tick_size : Float32 = 0.2_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D distance measuring ruler.


[View source]
def sector_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32 = 24, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D pie-slice sector.


[View source]
def sphere_3d(center : Godot::Vector3, radius : Float32 = 1.0_f32, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), rings : Int32 = 16, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D orthogonal ring wireframe sphere.


[View source]
def sphere_cast_3d(from : Godot::Vector3, to : Godot::Vector3, radius : Float32 = 0.5_f32, hit : Bool = false, color : Godot::Color = Godot::Color.new(0.0_f32, 0.9_f32, 1.0_f32, 0.8_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a swept sphere cast.


[View source]
def spring_3d(from : Godot::Vector3, to : Godot::Vector3, radius : Float32 = 0.2_f32, coils : Int32 = 8, segments : Int32 = 16, color : Godot::Color = Godot::Color.new(1.0_f32, 0.9_f32, 0.1_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D helical wire spring.


[View source]
def stat_graph_2d(title : String, value : Number, rect : Godot::Rect2 = Godot::Rect2.new(20.0_f32, 20.0_f32, 160.0_f32, 50.0_f32), min_val : Number = 0.0, max_val : Number = 100.0, color : Godot::Color = Godot::Color.new(0.2_f32, 0.9_f32, 0.3_f32, 1.0_f32)) #

Renders a real-time sparkline telemetry graph.


[View source]
def surface_disk_3d(position : Godot::Vector3, normal : Godot::Vector3, radius : Float32 = 0.5_f32, segments : Int32 = 24, color : Godot::Color = Godot::Color.new(0.0_f32, 0.8_f32, 0.9_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a circular surface contact disc.


[View source]
def telemetry_graph_2d(title : String, value : Number, rect : Godot::Rect2 = Godot::Rect2.new(20.0_f32, 20.0_f32, 160.0_f32, 50.0_f32), min_val : Number = 0.0, max_val : Number = 100.0, color : Godot::Color = Godot::Color.new(0.2_f32, 0.9_f32, 0.3_f32, 1.0_f32)) #

Alias for #stat_graph_2d.


[View source]
def text_2d(position : Godot::Vector2, text : String, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D text label on the canvas overlay.


[View source]
def text_3d(position : Godot::Vector3, text : String, color : Godot::Color = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D billboard text label.


[View source]
def trail_3d(id : String, current_position : Godot::Vector3, max_points : Int32 = 60, color : Godot::Color = Godot::Color.new(0.9_f32, 0.2_f32, 0.9_f32, 1.0_f32), on_top : Bool = true) #

Updates a 3D motion trail.


[View source]
def trajectory_arc_3d(origin : Godot::Vector3, velocity : Godot::Vector3, gravity : Godot::Vector3 = Godot::Vector3.new(0.0_f32, -9.8_f32, 0.0_f32), max_time : Float32 = 3.0_f32, steps : Int32 = 40, color : Godot::Color = Godot::Color.new(0.2_f32, 1.0_f32, 0.3_f32, 1.0_f32), duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a ballistic projectile trajectory arc.


[View source]
def vision_cone_2d(origin : Godot::Vector2, dir : Godot::Vector2, distance : Float32, angle_rad : Float32, segments : Int32 = 16, color : Godot::Color = Godot::Color.new(0.0_f32, 0.9_f32, 1.0_f32, 0.8_f32), duration : Float64 = 0.0, channel : String | Nil = nil) #

Draws a 2D vision cone or detection wedge.


[View source]
def vision_cone_3d(origin : Godot::Vector3, direction : Godot::Vector3, angle_deg : Float32 = 45.0_f32, range : Float32 = 10.0_f32, color : Godot::Color = Godot::Color.new(0.0_f32, 0.9_f32, 1.0_f32, 0.8_f32), segments : Int32 = 24, duration : Float64 = 0.0, on_top : Bool = true, channel : String | Nil = nil) #

Draws a 3D vision / sensory cone.


[View source]
def with_transform(xform : Godot::Transform3D, &block) : Void #

Executes a block with a local 3D transform applied to all nested 3D drawing calls.


[View source]