Skip to content

Engine → Renderer → debug_draw.h

debug_draw_buffer

Syntax

class CONJURE_API debug_draw_buffer

Constructors

AccessSignatureDescription
publicdebug_draw_buffer();
publicdebug_draw_buffer( const debug_draw_buffer &) = default;
publicdebug_draw_buffer( debug_draw_buffer &&) noexcept = default;

Destructors

AccessSignatureDescription
public~debug_draw_buffer();

Variables

AccessNameTypeDefaultDescription
privatemDepthTestedstd::vector<debug_vertex>{}
privatemDroppedu320
privatemOverlaystd::vector<debug_vertex>{}

Functions

Public

append

void append(
    const debug_draw_buffer &other);

Appends every vertex of another buffer and adds its dropped count to this one's.

axes

void axes(
    const math::mat4 &worldFromLocal,
    f32 length = 1.0f,
    debug_depth depth = debug_depth::TESTED);

Three axis lines (red X, green Y, blue Z) of length from the origin of a transform.

box

void box(
    const math::aabb &box,
    const math::vec4 &colour,
    debug_depth depth = debug_depth::TESTED);

The twelve edges of a box (24 vertices). An invalid box adds nothing.

clear

void clear() noexcept;

Empties both lists and resets the dropped counter; capacity is kept.

depth_tested

[[nodiscard]] std::span<const debug_vertex> depth_tested() const noexcept;

dropped_count

[[nodiscard]] u32 dropped_count() const noexcept;

Vertices refused because a list was at MAX_DEBUG_VERTICES.

empty

[[nodiscard]] bool empty() const noexcept;

frustum

void frustum(
    const math::mat4 &clipFromWorld,
    const math::vec4 &colour,
    debug_depth depth = debug_depth::TESTED);

The twelve edges of the view volume of a clip-from-world matrix (24 vertices).

grid

void grid(
    const math::vec3 &centre,
    u32 halfLines,
    f32 spacing,
    const math::vec4 &colour,
    debug_depth depth = debug_depth::TESTED);

A grid in the XZ plane centred on centre: (2 * halfLines + 1) lines along each axis, spacing apart.

line

void line(
    const math::vec3 &a,
    const math::vec3 &b,
    const math::vec4 &colour,
    debug_depth depth = debug_depth::TESTED);

One line from a to b.

overlay

[[nodiscard]] std::span<const debug_vertex> overlay() const noexcept;

sphere

void sphere(
    const math::vec3 &centre,
    f32 radius,
    const math::vec4 &colour,
    debug_depth depth = debug_depth::TESTED,
    u32 segments = 24);

Three great circles of segments lines each.

Private

push_line

void push_line(
    const math::vec3 &a,
    const math::vec3 &b,
    u32 packed,
    debug_depth depth);

Operator Overloads

Public

operator=

debug_draw_buffer &operator=(
    const debug_draw_buffer &) = default;
debug_draw_buffer &operator=(
    debug_draw_buffer &&) noexcept = default;