do not edit — generated by btf.
git.druid.rocksindexmilitantprogrammerastral_canvasshaders/text.vert

shaders/text.vert


#version 450
 
layout(location = 0) in vec2 i_pos;
layout(location = 1) in vec4 i_color;
layout(location = 2) in uint i_ch;
 
layout(location = 0) out vec2 v_uv;
layout(location = 1) out vec4 v_color;
 
layout(std140, set = 0, binding = 0) uniform Scene {
    vec2 resolution;
    float scale;
    float hud_h;
    float cell_w;
    float cell_h;
    int cols;
    int rows;
    int hover_col;
    int hover_row;
    int hover;
    int _pad0;
    vec4 bg;
    vec4 grid;
    vec4 hover_color;
    vec4 bar;
} u;
 
void main()
{
    const vec2 corners[6] = vec2[](
        vec2(0.0, 0.0), vec2(1.0, 0.0), vec2(0.0, 1.0),
        vec2(0.0, 1.0), vec2(1.0, 0.0), vec2(1.0, 1.0)
    );
    vec2 corner = corners[gl_VertexIndex];
 
    float s = max(u.scale, 1.0);
    vec2 px = i_pos * s + corner * 8.0 * s;
    vec2 ndc = px / u.resolution * 2.0 - 1.0;
    gl_Position = vec4(ndc, 0.0, 1.0);
 
    uint ch = i_ch;
    if (ch < 32u || ch > 126u)
        ch = 63u; /* '?' */
    uint idx = ch - 32u;
    uint col = idx % 16u;
    uint row = idx / 16u;
    v_uv = (vec2(float(col), float(row)) + corner) * 8.0 / vec2(128.0, 48.0);
    v_color = i_color;
}
powered by btf.