Queues SDF glyph quads for world-space and screen-space text.
More...
#include <SdfRenderer.hpp>
|
| bool | init (SDL_GPUDevice *dev, const char *ttfPath) |
| | Initialise the renderer by loading a font and baking the SDF atlas.
|
| |
| void | quit () |
| | Release all resources owned by this renderer.
|
| |
| void | drawWorldText (glm::vec3 worldPos, std::string_view text, glm::vec4 color, float worldHeight, glm::vec3 camRight, glm::vec3 camUp) |
| | Queue world-space billboard text (faces camera, depth-tested).
|
| |
| void | drawScreenText (glm::vec2 pixelPos, std::string_view text, glm::vec4 color, float pixelHeight) |
| | Queue HUD text in pixel coordinates (no depth test).
|
| |
| void | clear () |
| | Clear queues (called at start of each frame).
|
| |
| const SdfGlyphGPU * | worldData () const |
| | Get a pointer to the world-space glyph data buffer.
|
| |
| uint32_t | worldCount () const |
| | Get the number of queued world-space glyphs.
|
| |
| const SdfGlyphGPU * | hudData () const |
| | Get a pointer to the HUD glyph data buffer.
|
| |
| uint32_t | hudCount () const |
| | Get the number of queued HUD glyphs.
|
| |
| bool | ready () const |
| | Check whether the underlying atlas is ready for rendering.
|
| |
| const SdfAtlas & | atlas () const |
| | Access the underlying SDF atlas (provides GPU texture binding).
|
| |
Queues SDF glyph quads for world-space and screen-space text.
Call drawWorldText() / drawScreenText() each frame to queue text. The ParticleSystem flushes the queues during uploadToGpu() / render().
◆ atlas()
| const SdfAtlas & SdfRenderer::atlas |
( |
| ) |
const |
|
inline |
Access the underlying SDF atlas (provides GPU texture binding).
- Returns
- Const reference to the SdfAtlas.
◆ clear()
| void SdfRenderer::clear |
( |
| ) |
|
Clear queues (called at start of each frame).
Clear all queued glyph data for the current frame.
◆ drawScreenText()
| void SdfRenderer::drawScreenText |
( |
glm::vec2 |
pixelPos, |
|
|
std::string_view |
text, |
|
|
glm::vec4 |
color, |
|
|
float |
pixelHeight |
|
) |
| |
Queue HUD text in pixel coordinates (no depth test).
- Parameters
-
| pixelPos | Screen-space position in pixels. |
| text | UTF-8 text string to render. |
| color | RGBA colour for all glyphs. |
| pixelHeight | Desired text height in pixels. |
◆ drawWorldText()
| void SdfRenderer::drawWorldText |
( |
glm::vec3 |
worldPos, |
|
|
std::string_view |
text, |
|
|
glm::vec4 |
color, |
|
|
float |
worldHeight, |
|
|
glm::vec3 |
camRight, |
|
|
glm::vec3 |
camUp |
|
) |
| |
Queue world-space billboard text (faces camera, depth-tested).
- Parameters
-
| worldPos | World-space origin of the text baseline. |
| text | UTF-8 text string to render. |
| color | RGBA colour for all glyphs. |
| worldHeight | Desired text height in world units. |
| camRight | Camera right vector for billboarding. |
| camUp | Camera up vector for billboarding. |
◆ hudCount()
| uint32_t SdfRenderer::hudCount |
( |
| ) |
const |
|
inline |
Get the number of queued HUD glyphs.
- Returns
- HUD glyph count.
◆ hudData()
Get a pointer to the HUD glyph data buffer.
- Returns
- Pointer to the first HUD glyph, or nullptr if empty.
◆ init()
| bool SdfRenderer::init |
( |
SDL_GPUDevice * |
dev, |
|
|
const char * |
ttfPath |
|
) |
| |
Initialise the renderer by loading a font and baking the SDF atlas.
- Parameters
-
| dev | GPU device used for atlas texture creation. |
| ttfPath | Filesystem path to the TTF font file. |
- Returns
- true on success.
◆ quit()
| void SdfRenderer::quit |
( |
| ) |
|
Release all resources owned by this renderer.
◆ ready()
| bool SdfRenderer::ready |
( |
| ) |
const |
|
inline |
Check whether the underlying atlas is ready for rendering.
- Returns
- true if the atlas texture is valid.
◆ worldCount()
| uint32_t SdfRenderer::worldCount |
( |
| ) |
const |
|
inline |
Get the number of queued world-space glyphs.
- Returns
- World glyph count.
◆ worldData()
Get a pointer to the world-space glyph data buffer.
- Returns
- Pointer to the first world glyph, or nullptr if empty.
The documentation for this class was generated from the following files: