render3d: HUD text, panels and images share a draw - the font stays bound and each vertex says what it reads
A panel and its label alternated the white and font textures, and every switch closed the overlay's draw range: 77-91 ranges a frame in town. The font atlas is now bound beside the image texture for the whole flush, and v carries 4 x the vertex's mode (0 image, 1 font, 2 flat colour) on top of its real coordinate, so only a different image texture or a clip rectangle closes a range. Town: 24 ranges. OpenGL frames byte-identical at all five viewpoints; MoltenVK with validation adds no message. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
cdfffa62bb
commit
eb1cd3e01a
4 changed files with 33 additions and 21 deletions
|
|
@ -1,14 +1,20 @@
|
|||
// 2D overlay: a texture times a colour; the font atlas is white glyphs on alpha
|
||||
// 2D overlay: an image texture, the font atlas (white glyphs on alpha) or a flat colour, times a
|
||||
// colour. Which one is the vertex's own: v carries 4 x the mode (0 image, 1 font, 2 flat) on top of
|
||||
// its real coordinate, so text, panels and an image's quads share a draw (overlay.ludic, ov_use_tex).
|
||||
in vec2 v_uv;
|
||||
in vec4 v_col;
|
||||
uniform sampler2D u_tex;
|
||||
uniform float u_is_font;
|
||||
uniform sampler2D u_font;
|
||||
out vec4 o_color;
|
||||
void main() {
|
||||
vec4 t = texture(u_tex, v_uv);
|
||||
if (u_is_font > 0.5) {
|
||||
o_color = vec4(v_col.rgb, v_col.a * t.a);
|
||||
float mode = floor((v_uv.y + 0.5) * 0.25);
|
||||
vec2 uv = vec2(v_uv.x, v_uv.y - 4.0 * mode);
|
||||
if (mode > 1.5) {
|
||||
o_color = v_col;
|
||||
} else if (mode > 0.5) {
|
||||
o_color = vec4(v_col.rgb, v_col.a * texture(u_font, uv).a);
|
||||
} else {
|
||||
vec4 t = texture(u_tex, uv);
|
||||
o_color = vec4(v_col.rgb * t.rgb, v_col.a * t.a);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue