forked from 1b-agent/opencadstudio-upstream
feat(text): SDF glyph-atlas foundation for shader text rendering
Groundwork to render CAD text as per-glyph SDF quads (box-quad snap, perf, no LOD) instead of stroke-polyline wires. CPU side fully tested; GPU side compiles but is not yet wired into the render loop. - scene::text::sdf_atlas — GlyphAtlas: shelf packer + R8 SDF tiles baked per (font, char). Unified field so one shader draws both kinds: TrueType = signed distance to the filled outline, LFF stroke = pen band. Uses only crates already in the tree (ttf-parser/lyon via the existing Glyph). - scene::text::glyph_quads — layout_glyph_quads: lays a run out as per-glyph quads using the exact tessellate_text_run transform, so quads land where the strokes would. Per-char advance (TTF shaping is a follow-up). - shaders/text.wgsl — SDF fragment shader (smoothstep over fwidth), RTE vertex path mirroring image.wgsl, per-vertex colour + draw-order bias. - scene::pipeline::text_gpu — TextVertex + double-single vertex builder, R8 atlas texture upload, bind group, and the image-cloned pipeline. 13 unit tests across the three CPU stages, all green. Modules carry #![allow(dead_code)] until the render-loop integration lands. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
9490c85b32
commit
374cf7e89f
6 files changed
+1065
No files matched your search
@@ -1,5 +1,7 @@
|
||||
pub mod lff;
|
||||
pub mod font_face;
|
||||
pub mod glyph_quads;
|
||||
pub mod sdf_atlas;
|
||||
pub mod sysfont;
|
||||
pub mod ttf_glyph;
|
||||
pub mod web_font;
|
||||
|
||||
Reference in new issue
Block a user