Skip to content

[Feature] Text rendeirng pipeline #146

@vmarcella

Description

@vmarcella

Overview

Create a rendering pipeline that draws laid-out text using the glyph atlas,
producing visible text on screen.

Current State

No response

Scope

Goals:

  • Shader for rendering atlas glyphs
  • Batch multiple text draws efficiently
  • Support text color
  • Integrate with existing render command system

Non-Goals:

  • Text effects (shadows, outlines)
  • SDF rendering

Proposed API

pub struct TextRenderer {
  pipeline: ResourceId,
  vertex_buffer: Buffer,
  bind_group: ResourceId,
}

impl TextRenderer {
  pub fn new(render_context: &mut RenderContext, atlas: &GlyphAtlas) -> Self;
  
  pub fn draw(
    &mut self,
    layout: &TextLayout,
    position: [f32; 2],
    color: [f32; 4],
  ) -> Vec<RenderCommand>;
  
  pub fn update_atlas(&mut self, atlas: &GlyphAtlas);
}

// Or integrated with RenderContext
impl RenderContext {
  pub fn draw_text(
    &mut self,
    text: &str,
    font: Handle<Font>,
    size: f32,
    position: [f32; 2],
    color: [f32; 4],
  ) -> Vec<RenderCommand>;
}

Acceptance Criteria

  • Text renders at correct position
  • Text color applies correctly
  • Multiple text draws batch together
  • Transparent background (alpha blending)
  • Example rendering "Hello World"

Affected Crates

lambda-rs

Notes

  • Use instancing for glyph quads
  • Alpha blending required for smooth edges

Metadata

Metadata

Assignees

No one assigned

    Labels

    UIAll things user interface relatedenhancementNew feature or requestlambda-rsIssues pertaining to the core framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions