pub struct DebugDraw { /* private fields */ }Expand description
The immediate-mode buffer every system appends to, and the pass that draws it.
Built by ForwardRenderer, which owns one and
hands it out through
debug_draw; appending is all a system
ever does with it.
Implementations§
Source§impl DebugDraw
impl DebugDraw
Sourcepub const MAX_PASSES: u32 = 1
pub const MAX_PASSES: u32 = 1
The most passes this layer adds to one frame.
The most rather than the count: a frame with nothing appended adds none.
What a caller sizing PassTimers adds up.
ForwardRenderer::add_passes is
what records it.
Sourcepub fn enabled() -> bool
pub fn enabled() -> bool
Whether the console has the layer switched on.
The read half of r_debug_draw, for a system deciding whether to build
its overlay at all: appending while it is off is harmless — the buffer is
cleared and never uploaded — but a system whose geometry costs something
to compute wants to know before it computes it.
Sourcepub fn line(&mut self, from: Vec3, to: Vec3, color: [f32; 4])
pub fn line(&mut self, from: Vec3, to: Vec3, color: [f32; 4])
Appends one world-space segment.
Every other primitive here is written in terms of this one.
Sourcepub fn aabb(&mut self, min: Vec3, max: Vec3, color: [f32; 4])
pub fn aabb(&mut self, min: Vec3, max: Vec3, color: [f32; 4])
Appends the twelve edges of the axis-aligned box spanning min..=max.
Sourcepub fn frustum(&mut self, view_proj: Mat4, color: [f32; 4])
pub fn frustum(&mut self, view_proj: Mat4, color: [f32; 4])
Appends the twelve edges of the view volume view_proj projects.
A view volume with no finite corners appends nothing and says so, on
frustum_corners’s terms — which is the engine’s own camera, whose
far plane is at infinity. A caller that wants to handle that itself calls
frustum_corners and box_edges.
Sourcepub fn box_edges(&mut self, corners: &[Vec3; 8], color: [f32; 4])
pub fn box_edges(&mut self, corners: &[Vec3; 8], color: [f32; 4])
Appends the twelve edges joining eight corners in frustum_corners’
order.
What aabb and frustum share: a box and
a view volume differ in where their corners come from and in nothing
else.
Sourcepub fn sphere(&mut self, centre: Vec3, radius: f32, color: [f32; 4])
pub fn sphere(&mut self, centre: Vec3, radius: f32, color: [f32; 4])
Appends three great circles of radius about centre, one in each
coordinate plane, each of SPHERE_SEGMENTS segments.
Three circles rather than a mesh of latitudes and longitudes: what a debug sphere has to show is where a radius reaches, and three rings show it from any angle without filling the frame with lines.