Files
xiaozhou233 6a045fd46f Perf: Reduce font atlas memory and bake cost
- Size atlases from the requested glyph set (Latin 512-2048, CJK 1024-4096) and double on overflow instead of always using a 4096x4096 sheet

- Share one atlas between logical sizes; CJK bake heights are bucketed (12-36px) so neighbouring sizes reuse the same Noto sheet

- Pack Latin at 2x2 and CJK at 1x1 oversampling in two stb passes; the context-wide 2x2 setting was quadrupling CJK atlases

- Budget font textures with -Dorangex.font.atlasBudgetMb (128 MB) using frame-pinned LRU eviction, plus idle release (-Dorangex.font.idleSeconds, 30s) and face cleanup

- Upload 1.8.9 atlases as GL_LUMINANCE_ALPHA with premultiplied glyph blending (2 bytes per texel) and restore the previous blend function after a frame

- Write 26.2 RGBA pixels straight into the NativeImage buffer instead of building a second full-size array

- Move the string width cache into FontFace so it survives across frames, and hoist HUD getFont calls out of the render loops
2026-11-08 01:50:22 +08:00
..

渲染相关文档

本目录记录客户端字体、GUI 与跨版本渲染实现的分析与设计参考。

文档索引

文档 内容
vape-font-gui-rendering.md Vape 4.21 的字体光栅化、文本排版、GUI 组件树、双渲染后端与 1.7.10–26.2 跨版本路径分析
font-port.md OrangeX 的字体移植实现:TTF 烘焙、Render2D API、1.8.9 / 26.2 接入、调试参数与限制
gui-rendering.md 2D GUI 绘制层:矩形、渐变、圆角、描边、直线、裁剪及两版本实现
world-gating-and-input.md 世界内渲染判定、1.8.9 / 26.2 鼠标捕获差异,以及已落地的空 GUI / 输入层实现

快速导航

  • 字体资源与语言选择 → 主文档 §2.1
  • stb_truetype 字形图集 → 主文档 §2.2
  • Buffered / Legacy 字体渲染器 → 主文档 §2.3
  • Minecraft 原生 FontSet 字体桥 → 主文档 §2.4
  • § 颜色码、阴影、宽度缓存、GUI Scale → 主文档 §2.5
  • 中文覆盖与构建期校验 → 主文档 §2.6
  • ClickGUI 生命周期与输入 → 主文档 §3.1
  • 坐标系统与缩放 → 主文档 §3.2
  • 组件树与布局 → 主文档 §3.3
  • GuiRenderPrimitives 双后端 → 主文档 §3.4
  • Universal Shader 批次渲染 → 主文档 §3.5
  • 1.21.6+ / 26.x 兼容 → 主文档 §3.7
  • 版本矩阵 → 主文档 §4
  • 世界内渲染判定与鼠标输入 → world-gating-and-input.md

阅读前提

主文档以 E:\Vape-v4.21 为源码根,涉及的文件路径均相对于该目录。 文中结论来自静态源码阅读,运行时行为仍需结合实际客户端验证。