SB-003-RENDER_SYSTEM.md
(P0, 369 lines)
- PVR2-based text rendering system
- Components: Font Manager, Screen Manager, Texture Atlas, PVR2
Renderer
- Data structures:
d3tui_glyph_t (metrics + tex coords),
d3tui_font_t (name, size, texture ptr, glyph array),
d3tui_render_ctx_t (font, colors, cursor, cell size, dirty
flag)
- Public API: font_load/free, render_create/destroy,
set_font/colors/cell_size, render_char/text/move_cursor, flush
- PVR2 texture formats: ARGB1555 (fonts), RGB565 (backgrounds),
ARGB4444 (high-quality)
- Font texture atlas: 16x16 grid of 256 chars, typically 256x256,
ARGB1555, 1-pixel padding
- Rendering pipeline: pvr_scene_begin → polygon headers → submit quads
per char → cursor → pvr_scene_finish
- Custom
.d3f binary font format defined (magic “D3TF”,
version 1, glyph table + texture data)
- Font conversion tool
d3tui-fontconv (Python, Pillow) to
convert TTF/OTF → .d3f
- Optimizations: batch rendering, dirty rectangles, texture atlases,
PVR2 Store Queue (SQ) for vertex submission