-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
UIAll things user interface relatedAll things user interface relatedassetsAll things asset/asset management relatedAll things asset/asset management relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework
Description
Overview
Create a texture atlas system that packs rasterized glyphs into a single
texture for efficient GPU rendering.
Current State
No response
Scope
Goals:
- Pack multiple glyphs into one texture
- Track UV coordinates for each glyph
- Dynamic atlas growth when full
- Support multiple fonts/sizes in one atlas
Non-Goals:
- SDF generation
- Atlas serialization
Proposed API
pub struct GlyphAtlas {
texture: Texture,
glyph_info: HashMap<GlyphKey, GlyphUV>,
}
pub struct GlyphKey {
pub font_id: u32,
pub character: char,
pub size_px: u32, // discretized
}
pub struct GlyphUV {
pub uv_min: [f32; 2],
pub uv_max: [f32; 2],
pub metrics: GlyphMetrics,
}
impl GlyphAtlas {
pub fn new(gpu: &Gpu, initial_size: u32) -> Self;
pub fn get_or_insert(&mut self, font: &Font, char: char, size: f32) -> &GlyphUV;
pub fn texture(&self) -> &Texture;
pub fn clear(&mut self);
}Acceptance Criteria
- Glyphs packed into texture
- UV coordinates accurate
- Atlas grows when needed
- Multiple fonts coexist in atlas
- Cache hit returns existing glyph
Affected Crates
lambda-rs
Notes
- Binary tree packing or shelf algorithm
- Consider max atlas size limit
Metadata
Metadata
Assignees
Labels
UIAll things user interface relatedAll things user interface relatedassetsAll things asset/asset management relatedAll things asset/asset management relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework