Skip to content

Engine → Renderer → sprite_batch.h

sprite_batcher

Syntax

class CONJURE_API sprite_batcher

Constructors

AccessSignatureDescription
publicsprite_batcher();

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~sprite_batcher();

Variables

AccessNameTypeDefaultDescription
privatemDroppedu320
privatemIndicesstd::vector<u32>{}
privatemKeysstd::vector<u64>{}
privatemOrderstd::vector<u32>{}
privatemOverflowWarnedboolfalse
privatemRunsstd::vector<sprite_run>{}
privatemScratchKeysstd::vector<u64>{}
privatemScratchValuesstd::vector<u32>{}
privatemVerticesstd::vector<sprite_vertex>{}

Functions

Public

build

void build(
    std::span<const sprite> sprites);

Rebuilds vertices, indices and runs from the sprites. Keeps capacity between calls. Logs the overflow WARN when this build drops sprites and the one before it dropped none.

clear

void clear() noexcept;

Forgets the output and the dropped count; capacity is kept, and so is whether the overflow WARN is armed (only a build decides that).

dropped_count

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

Sprites dropped by the last build because the cap was reached (both spaces); 0 after clear(). The renderer reports its batcher's count as render_stats::spritesDropped.

indices

[[nodiscard]] std::span<const u32> indices() const noexcept;

runs

[[nodiscard]] std::span<const sprite_run> runs() const noexcept;

sort_key

[[nodiscard]] static u64 sort_key(
    const sprite &value) noexcept;

The sort key of a sprite: space, then layer, order and texture, all ascending.

sprite_count

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

Number of sprites the last build emitted.

vertices

[[nodiscard]] std::span<const sprite_vertex> vertices() const noexcept;