aboutsummaryrefslogtreecommitdiff
path: root/src/render_helpers/shaders/texture.vert
blob: 1a6a4052942a077e4fbf37b3c749ad6a64d98dc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#version 100

uniform mat3 matrix;
uniform mat3 tex_matrix;

attribute vec2 vert;
attribute vec4 vert_position;

varying vec2 niri_v_coords;

mat2 scale(vec2 scale_vec){
    return mat2(
        scale_vec.x, 0.0,
        0.0, scale_vec.y
    );
}

void main() {
    vec2 vert_transform_translation = vert_position.xy;
    vec2 vert_transform_scale = vert_position.zw;
    vec3 position = vec3(vert * scale(vert_transform_scale) + vert_transform_translation, 1.0);
    niri_v_coords = (tex_matrix * position).xy;
    gl_Position = vec4(matrix * position, 1.0);
}