Accumulates HUD geometry during a frame for batch rendering.
More...
#include <HudContext.hpp>
|
| void | init (const SdfAtlas *atlas) |
| | Bind the SDF atlas for text layout (glyph metrics).
|
| void | beginFrame () |
| | Clear all geometry for a new frame.
|
| void | rect (float x, float y, float w, float h, HudColor color) |
| void | rectOutline (float x, float y, float w, float h, float thickness, HudColor color) |
| void | roundedRect (float x, float y, float w, float h, float radius, HudColor color) |
| void | rotatedRect (float cx, float cy, float w, float h, float angleDeg, HudColor color) |
| void | bar (float x, float y, float w, float h, float fill01, HudColor fg, HudColor bg) |
| void | text (const char *str, float x, float y, float size, HudColor color, HudAlign align=HudAlign::Left) |
| float | measureText (const char *str, float size) const |
| void | icon (HudIcon id, float x, float y, float size, HudColor tint=HudColor::white()) |
| void | crosshair (const CrosshairStyle &style, float screenW, float screenH) |
| void | vignette (float screenW, float screenH, HudColor color) |
| | Draw a full-screen radial vignette overlay.
|
| void | pushClipRect (float x, float y, float w, float h) |
| void | popClipRect () |
| void | endFrame () |
| | Flush any remaining unflushed vertices into a final clip span.
|
| const std::vector< HudVertex > & | vertices () const |
| const std::vector< std::array< float, 6 > > & | clipSpans () const |
| | Clip rect spans: {startVertex, vertexCount, x, y, w, h}.
|
|
| void | emitQuad (float x, float y, float w, float h, float u0, float v0, float u1, float v1, HudColor color, float texMode, float sd0=0.f, float sd1=0.f, float sd2=0.f) |
| | Emit 6 vertices for a textured quad.
|
| void | flushClipSpan () |
| | Flush the current clip span before changing scissor state.
|
Accumulates HUD geometry during a frame for batch rendering.
Widgets call rect(), text(), bar(), etc. to emit quads. At the end of the frame, HudRenderer consumes the vertex buffer and clip rect list.
◆ bar()
| void HudContext::bar |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h, |
|
|
float | fill01, |
|
|
HudColor | fg, |
|
|
HudColor | bg ) |
◆ beginFrame()
| void HudContext::beginFrame |
( |
| ) |
|
Clear all geometry for a new frame.
◆ clipSpans()
| const std::vector< std::array< float, 6 > > & HudContext::clipSpans |
( |
| ) |
const |
|
inlinenodiscard |
Clip rect spans: {startVertex, vertexCount, x, y, w, h}.
Negative w means "full viewport" (no scissor).
◆ crosshair()
| void HudContext::crosshair |
( |
const CrosshairStyle & | style, |
|
|
float | screenW, |
|
|
float | screenH ) |
◆ emitQuad()
| void HudContext::emitQuad |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h, |
|
|
float | u0, |
|
|
float | v0, |
|
|
float | u1, |
|
|
float | v1, |
|
|
HudColor | color, |
|
|
float | texMode, |
|
|
float | sd0 = 0.f, |
|
|
float | sd1 = 0.f, |
|
|
float | sd2 = 0.f ) |
|
private |
Emit 6 vertices for a textured quad.
◆ endFrame()
| void HudContext::endFrame |
( |
| ) |
|
Flush any remaining unflushed vertices into a final clip span.
Must be called after all draw() calls, before accessing vertices/clipSpans.
◆ flushClipSpan()
| void HudContext::flushClipSpan |
( |
| ) |
|
|
private |
Flush the current clip span before changing scissor state.
◆ icon()
◆ init()
| void HudContext::init |
( |
const SdfAtlas * | atlas | ) |
|
Bind the SDF atlas for text layout (glyph metrics).
◆ measureText()
| float HudContext::measureText |
( |
const char * | str, |
|
|
float | size ) const |
◆ popClipRect()
| void HudContext::popClipRect |
( |
| ) |
|
◆ pushClipRect()
| void HudContext::pushClipRect |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h ) |
◆ rect()
| void HudContext::rect |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h, |
|
|
HudColor | color ) |
◆ rectOutline()
| void HudContext::rectOutline |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h, |
|
|
float | thickness, |
|
|
HudColor | color ) |
◆ rotatedRect()
| void HudContext::rotatedRect |
( |
float | cx, |
|
|
float | cy, |
|
|
float | w, |
|
|
float | h, |
|
|
float | angleDeg, |
|
|
HudColor | color ) |
◆ roundedRect()
| void HudContext::roundedRect |
( |
float | x, |
|
|
float | y, |
|
|
float | w, |
|
|
float | h, |
|
|
float | radius, |
|
|
HudColor | color ) |
◆ text()
◆ vertices()
| const std::vector< HudVertex > & HudContext::vertices |
( |
| ) |
const |
|
inlinenodiscard |
◆ vignette()
| void HudContext::vignette |
( |
float | screenW, |
|
|
float | screenH, |
|
|
HudColor | color ) |
Draw a full-screen radial vignette overlay.
- Parameters
-
| screenW | Viewport width in pixels. |
| screenH | Viewport height in pixels. |
| color | Tint color with alpha controlling intensity. |
◆ clipSpans_
| std::vector<std::array<float, 6> > HudContext::clipSpans_ |
|
private |
◆ clipStack_
| std::vector<std::array<float, 4> > HudContext::clipStack_ |
|
private |
◆ sdfAtlas_
| const SdfAtlas* HudContext::sdfAtlas_ = nullptr |
|
private |
◆ spanDirty_
| bool HudContext::spanDirty_ = false |
|
private |
◆ spanStartVertex_
| uint32_t HudContext::spanStartVertex_ = 0 |
|
private |
Vertex index where current clip span started.
◆ vertices_
The documentation for this class was generated from the following files: