This repository has been archived on 2023-10-09. You can view files and clone it, but cannot push or open issues or pull requests.
Files
blender-archive/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
Clément Foucault a5644f9a28 Cleanup: GPUBuiltinShader: Remove old shader interfaces
This leaves some of the unresolved case where we still need both
implementation.
2022-05-02 01:31:24 +02:00

23 lines
701 B
GLSL

void main()
{
color_flat = col;
glyph_offset = offset;
glyph_dim = abs(glyph_size);
interp_size = int(glyph_size.x < 0) + int(glyph_size.y < 0);
/* Quad expension using instanced rendering. */
float x = float(gl_VertexID % 2);
float y = float(gl_VertexID / 2);
vec2 quad = vec2(x, y);
vec2 interp_offset = float(interp_size) / abs(pos.zw - pos.xy);
texCoord_interp = mix(-interp_offset, 1.0 + interp_offset, quad);
vec2 final_pos = mix(vec2(ivec2(pos.xy) + ivec2(-interp_size, interp_size)),
vec2(ivec2(pos.zw) + ivec2(interp_size, -interp_size)),
quad);
gl_Position = ModelViewProjectionMatrix * vec4(final_pos, 0.0, 1.0);
}