mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-09 23:54:20 +02:00
Use symbolic names
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
#define tex_top 0
|
||||
#define tex_right 1
|
||||
#define tex_bottom 1
|
||||
#define x_axis 0
|
||||
#define y_axis 1
|
||||
#define window i
|
||||
#define image i + 2
|
||||
|
||||
uniform float adjust_scale;
|
||||
uniform vec2 transform; // [ pos_left_relative, pos_top_relative ]
|
||||
@@ -29,15 +33,18 @@ const vec2 tex_map[] = vec2[4](
|
||||
|
||||
|
||||
float scaling_factor(int i) {
|
||||
return adjust_scale * (sizes[i] / sizes[i + 2]) + (1 - adjust_scale);
|
||||
return adjust_scale * (sizes[window] / sizes[image]) + (1 - adjust_scale);
|
||||
}
|
||||
|
||||
float position_divisor(int i) {
|
||||
return (sizes[i] - sizes[i + 2]) * transform[i] / sizes[i + 2];
|
||||
return (sizes[window] - sizes[image]) * transform[i] / sizes[image];
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 tex_coords = tex_map[gl_VertexID];
|
||||
texcoord = vec2(tex_coords[0] * scaling_factor(0) - position_divisor(0), tex_coords[1] * scaling_factor(1) - position_divisor(1));
|
||||
texcoord = vec2(
|
||||
tex_coords[x_axis] * scaling_factor(x_axis) - position_divisor(x_axis),
|
||||
tex_coords[y_axis] * scaling_factor(y_axis) - position_divisor(y_axis)
|
||||
);
|
||||
gl_Position = vec4(pos_map[gl_VertexID], 0, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user