Engine → Renderer → debug_draw.h
debug_draw¶
| Type | Class |
| Namespace | conjure::renderer |
| Include File Path | engine/include/conjure/renderer/debug_draw.h |
| Source File Path | engine/src/renderer/debug_draw.cpp |
| API ↗ | Rendering, Rendering a frame |
Syntax¶
Constructors¶
| Access | Signature | Description |
|---|---|---|
| public | debug_draw(); |
Important
Copy constructor and assignment has been deleted.
Destructors¶
| Access | Signature | Description |
|---|---|---|
| public | ~debug_draw(); |
Variables¶
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mImmediate | debug_draw_buffer | {} | |
| private | m | std::vector<text_record> | {} | |
| private | m | std::vector<char> | {} | |
| private | mMutex | mutable std::mutex | {} | |
| private | mStats | debug_draw_stats | {} | |
| private | mTimed | std::vector<timed_entry> | {} | |
| private | mTimedText | std::vector<text_record> | {} | |
| private | m | std::vector<char> | {} |
Functions¶
Public¶
append_to¶
append_to¶void append_to(
debug_draw_buffer &target);append_to(target, view) without a view: the shapes are appended, this frame's text is dropped and counted, and the timed text is kept but not drawn.
void append_to(
debug_draw_buffer &target,
const debug_text_view &view);Appends the immediate shapes and every live timed shape to target, expands this frame's text and every live timed text against view into lines there, and clears the immediate shapes and text. Without a view (see debug_text_view) this frame's text is dropped and counted in textDroppedWithoutView and the timed text is not drawn this time. Text anchored at or behind a perspective camera's eye draws nothing. Records the vertices it added in lastAppendVertices.
axes¶
axes¶void axes(
const math::mat4 &worldFromLocal,
f32 length = 1.0f,
f32 durationSeconds = 0.0f,
debug_depth depth = debug_depth::TESTED);Axis lines (debug_draw_buffer::axes) that live this frame (durationSeconds not positive, NaN included) or for durationSeconds.
box¶
box¶void box(
const math::aabb &box,
const math::vec4 &colour,
f32 durationSeconds = 0.0f,
debug_depth depth = debug_depth::TESTED);A box (debug_draw_buffer::box) that lives this frame (durationSeconds not positive, NaN included) or for durationSeconds.
line¶
line¶void line(
const math::vec3 &a,
const math::vec3 &b,
const math::vec4 &colour,
f32 durationSeconds = 0.0f,
debug_depth depth = debug_depth::TESTED);A line that lives this frame (durationSeconds not positive, NaN included) or for durationSeconds.
sphere¶
sphere¶void sphere(
const math::vec3 ¢re,
f32 radius,
const math::vec4 &colour,
f32 durationSeconds = 0.0f,
debug_depth depth = debug_depth::TESTED);A sphere (debug_draw_buffer::sphere) that lives this frame (durationSeconds not positive, NaN included) or for durationSeconds.
stats¶
stats¶[[nodiscard]] debug_draw_stats stats() const;The text counters and the size of the last append_to.
submit¶
submit¶void submit(
const debug_draw_buffer &shape,
f32 durationSeconds = 0.0f);Adds a prepared buffer as an immediate (durationSeconds not positive, NaN included) or timed entry.
text¶
text¶void text(
const math::vec3 &anchor,
std::string_view utf8,
const math::vec4 &colour,
f32 durationSeconds = 0.0f,
debug_depth depth = debug_depth::OVERLAY);Debug text that lives this frame (durationSeconds not positive, NaN included) or for durationSeconds, drawn by append_to as lines of the built-in stroke font in the plane of the view's camera: each line centred horizontally on anchor, the first baseline through it and each line feed starting a line below, DEBUG_TEXT_PIXEL_HEIGHT times the view's UI scale pixels of its viewportHeightPixels high at any distance. OVERLAY by default, so a label stays visible inside what it names. Text longer than MAX_DEBUG_TEXT_BYTES is cut at a code point (textTruncated); a call that would take the queued text over MAX_DEBUG_TEXT_ARENA_BYTES is dropped (textDroppedArenaFull). Empty text queues and counts nothing. Each malformed UTF-8 byte draws '?'.
tick¶
tick¶void tick(
f32 deltaSeconds);Ages the timed shapes and text and drops the expired ones; the bytes of expired text are reclaimed (the timed arena is compacted and keeps its capacity).
timed_entry_count¶
timed_entry_count¶[[nodiscard]] usize timed_entry_count() const;Number of timed shapes still alive (timed text is not counted).
Private¶
add_timed¶
add_timed¶void add_timed(
debug_draw_buffer &&shape,
f32 durationSeconds);expand_text¶
expand_text¶static void expand_text(
debug_draw_buffer &target,
const text_record &record,
std::string_view utf8,
const debug_text_view &view);