struct Diorite::FrameBatchContext

Overview

Unified 2D/3D zero-allocation frame batch builder yielded by Diorite.frame { |batch| ... }.

Diorite.frame do |batch|
  batch.line(from, to, color)
  batch.box(aabb, color)
  batch.circle_2d(center_2d, 32.0_f32, color)
end

Defined in:

diorite/core/frame_arena_batch.cr

Constant Summary

DEFAULT_COLOR = Godot::Color.new(1.0_f32, 1.0_f32, 1.0_f32, 1.0_f32)
DEFAULT_GRID_COLOR = Godot::Color.new(0.6_f32, 0.6_f32, 0.6_f32, 0.5_f32)

Constructors

Instance Method Summary

Constructor Detail

def self.new(buffers : FrameDrawBuffers) #

def self.wrap(buffers : FrameDrawBuffers) : FrameBatchContext #

Instance Method Detail

def arc_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32 = 24, color : Godot::Color = DEFAULT_COLOR) : self #

def arrow(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, head_size : Float32 = 0.25_f32, on_top : Bool = true) : self #

def arrow_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = DEFAULT_COLOR, head_size : Float32 = 10.0_f32) : self #

def arrow_3d(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, head_size : Float32 = 0.25_f32, on_top : Bool = true) : self #

def box(center : Godot::Vector3, size : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def box(aabb : Godot::AABB, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def box_3d(center : Godot::Vector3, size : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def buffers : FrameDrawBuffers #

def canvas_2d : FrameBatchBuilder2D #

def capsule(center : Godot::Vector3, radius : Float32 = 0.5_f32, height : Float32 = 2.0_f32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 16, on_top : Bool = true) : self #

def capsule_2d(p0 : Godot::Vector2, p1 : Godot::Vector2, radius : Float32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 12) : self #

def capsule_3d(center : Godot::Vector3, radius : Float32 = 0.5_f32, height : Float32 = 2.0_f32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 16, on_top : Bool = true) : self #

def circle_2d(center : Godot::Vector2, radius : Float32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 24) : self #

def cylinder(center : Godot::Vector3, radius : Float32 = 1.0_f32, height : Float32 = 2.0_f32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 16, on_top : Bool = true) : self #

def cylinder_3d(center : Godot::Vector3, radius : Float32 = 1.0_f32, height : Float32 = 2.0_f32, color : Godot::Color = DEFAULT_COLOR, segments : Int32 = 16, on_top : Bool = true) : self #

def depth_3d : FrameBatchBuilder3D #

def draw_2d(& : FrameBatchBuilder2D -> ) : self #

def draw_3d(on_top : Bool = true, & : FrameBatchBuilder3D -> ) : self #

def gizmo(origin : Godot::Vector3, basis : Godot::Basis = Godot::Basis.new, size : Float32 = 1.0_f32, on_top : Bool = true) : self #

def gizmo_3d(origin : Godot::Vector3, basis : Godot::Basis = Godot::Basis.new, size : Float32 = 1.0_f32, on_top : Bool = true) : self #

def grid(center : Godot::Vector3 = Godot::Vector3.new, size : Godot::Vector2 = Godot::Vector2.new(10.0_f32, 10.0_f32), subdivisions : Int32 = 10, color : Godot::Color = DEFAULT_GRID_COLOR, on_top : Bool = true) : self #

def grid_3d(center : Godot::Vector3 = Godot::Vector3.new, size : Godot::Vector2 = Godot::Vector2.new(10.0_f32, 10.0_f32), subdivisions : Int32 = 10, color : Godot::Color = DEFAULT_GRID_COLOR, on_top : Bool = true) : self #

def line(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def line_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = DEFAULT_COLOR) : self #

def line_3d(from : Godot::Vector3, to : Godot::Vector3, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def line_path(points, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def line_path_3d(points, color : Godot::Color = DEFAULT_COLOR, on_top : Bool = true) : self #

def on_top_3d : FrameBatchBuilder3D #

def path_2d(pts, color : Godot::Color = DEFAULT_COLOR) : self #

def points_2d(pts, size : Float32 = 4.0_f32, color : Godot::Color = DEFAULT_COLOR) : self #

def rect_2d(r : Godot::Rect2, color : Godot::Color = DEFAULT_COLOR) : self #

def ruler_2d(from : Godot::Vector2, to : Godot::Vector2, color : Godot::Color = DEFAULT_COLOR, tick_step : Float32 = 20.0_f32, tick_size : Float32 = 8.0_f32) : self #

def sector_2d(center : Godot::Vector2, radius : Float32, start_angle : Float32, end_angle : Float32, segments : Int32 = 24, color : Godot::Color = DEFAULT_COLOR) : self #

def sphere(center : Godot::Vector3, radius : Float32 = 1.0_f32, color : Godot::Color = DEFAULT_COLOR, rings : Int32 = 16, on_top : Bool = true) : self #

def sphere_3d(center : Godot::Vector3, radius : Float32 = 1.0_f32, color : Godot::Color = DEFAULT_COLOR, rings : Int32 = 16, on_top : Bool = true) : self #

def telemetry_graph(graph : TelemetryGraph) : self #

def total_lines_2d : Int32 #

def total_lines_3d : Int32 #

def total_vertices_2d : Int32 #

def total_vertices_3d : Int32 #

def vision_cone_2d(origin : Godot::Vector2, dir : Godot::Vector2, distance : Float32, angle_rad : Float32, segments : Int32 = 16, color : Godot::Color = DEFAULT_COLOR) : self #