module
Eagle::Scene3D
Overview
Renders the 3D part of the scene tree, and holds the environment: sky, ambient light, fog and shadow settings.
The engine calls .render for you whenever a Camera3D is current. Use this module to
tweak the environment and to draw debug shapes.
Scene3D.environment.fog(20, 80)
Scene3D.environment.sky_colors(Color.hex("#3b6fd6"), Color.hex("#b9d4f5"), Color.hex("#3a3a44"))
Scene3D.environment.ambient = Color.gray(0.3)
Scene3D.debug_line(Vec3::ZERO, v3(0, 2, 0), Color::RED) # visible for one frame
Scene3D.debug_sphere(v3(1, 1, 1), 0.5_f32)
Defined in:
eagle/nodes/node3d.crClass Method Summary
-
.collect(root : Node) : Tuple(Array(DrawItem), Array(LightData))
Gathers draw items and lights from a subtree.
-
.debug_box(center : Vec3, half : Vec3, rotation : Quat = Quat::IDENTITY, color : Color = Color::GREEN) : Nil
Draws a box outline for the next frame only.
-
.debug_line(a : Vec3, b : Vec3, color : Color = Color::GREEN) : Nil
Draws a line for the next frame only.
-
.debug_sphere(center : Vec3, radius : Float32, color : Color = Color::GREEN, segments : Int32 = 16) : Nil
Draws a sphere outline for the next frame only.
-
.environment : Environment
The sky, ambient light, fog and shadow settings.
-
.environment=(e : Environment)
Replaces the environment.
-
.render(root : Node = SceneTree.root, camera : Camera3D | Nil = Camera3D.current, target_size : Vec2 = Window.size, flip_y : Bool = false, clear : Bool = true) : Nil
Renders a subtree from camera into the current target.
-
.renderer : Renderer3D
The shared 3D renderer.
Class Method Detail
Gathers draw items and lights from a subtree.
Draws a box outline for the next frame only.
Draws a line for the next frame only. Call it every frame to keep it visible.
Draws a sphere outline for the next frame only.
Renders a subtree from camera into the current target. The engine calls this each
frame; call it yourself to render into a Canvas, for mirrors or minimaps.