Drawing

Draw components are drawn by a klartraum::RenderPass, each with its own graphics pipeline.

class DrawComponent

Something a RenderPass draws with its own graphics pipeline.

Add it with RenderPass::addDrawComponent(). When the graph is compiled, the render pass calls setNumberPaths() and initialize() with its Vulkan render pass and camera uniform buffer, and then recordCommandBuffer() once per path.

Subclassed by klartraum::DrawBasics, klartraum::GaussianSplatMeshRasterizer, klartraum::GaussianSplatRasterizer, klartraum::TextDrawComponent

Basic shapes

class DrawBasics : public klartraum::DrawComponent

Draws a built-in shape (a triangle, a cube or the coordinate axes) with the camera of its render pass.

enum class klartraum::DrawBasicsType

Shapes that DrawBasics can draw.

Values:

enumerator Triangle
enumerator Cube
enumerator Axes

Debug text

class TextDrawComponent : public klartraum::DrawComponent

Draws one line of debug text (e.g. an FPS counter) as textured quads from a generated glyph atlas.

The engine records command buffers once at setup time and resubmits them unchanged every frame, so the draw call itself (vertex and index counts) must stay constant. To let the text change at runtime, this component reserves vertex-buffer space for a fixed maxCharacters and builds an index buffer for that many glyph quads once; setText() rewrites the mapped vertex buffers in place and pads unused glyph slots with zero-alpha, zero-area quads, so they contribute nothing to the image.

class SimpleTextRenderer

Builds the mesh of one line of text, one quad per glyph.

The caller handles line breaks and alignment; this class lays out a single line, advancing one fixed glyph cell per character.

Each glyph becomes a quad of 4 vertices (top-left, top-right, bottom-right, bottom-left) and 6 indices (two triangles), sized to the glyph’s pixel rectangle (GLYPH_PIXEL_WIDTH x GLYPH_PIXEL_HEIGHT) scaled by scale; consecutive glyphs are GLYPH_CELL_WIDTH x scale apart.