Skip to content

Engine → Renderer

sprite_batch.h

The 2D sprite batcher: pure CPU, public so tests build batches by hand. WORLD sprites become world-space quads drawn into the HDR target after blended meshes; SCREEN sprites become pixel-space quads (origin top-left, y down) drawn after tonemapping.

Structs

File Description
sprite One sprite as the extraction contract carries it (render_scene::sprites).
sprite_run A run of consecutive sprites sharing a space and a texture: one drawIndexed each.
sprite_vertex One quad vertex as the GPU consumes it (gpu_sprite_vertex, 32 bytes).

Classes

File Description
sprite_batcher Sorts sprites by (space, layer, order, texture), emits 4 vertices and 6 indices per sprite and splits the result into runs. The capacity is MAX_SPRITES_PER_FRAME and SCREEN sprites (the HUD) take their slots first: beyond it the WORLD sprites last in sort order (the front-most) are dropped, then, only when SCREEN sprites alone exceed the cap, the last SCREEN sprites. Dropped sprites are counted by every build (dropped_count()). A WARN naming the count per space is logged by the build in which the overflow starts: the builds that follow stay silent while they drop sprites, whatever the count becomes, and a build that drops none (an empty one included) arms the warning again. clear() does not arm it.

Enumerations

sprite_space

enum class sprite_space : u8 {
    WORLD = 0,
    SCREEN
};

Functions

Public

to_string

[[nodiscard]] CONJURE_API std::string_view to_string(
    sprite_space space) noexcept;

The enumerator name of a sprite space ("WORLD").