summaryrefslogtreecommitdiffhomepage
path: root/shaders/tile-shader.vert
blob: fe81ba3bc1b8f084c1a9f92213aa88f803fcff28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
precision highp float;

layout (location = 0) uniform vec2 scale;
layout (location = 1) uniform vec2 offset;

layout (location = 0) in vec4 position;
layout (location = 1) in vec2 texcoords;
noperspective out vec2 frag_texcoords;

void main() {
    frag_texcoords = texcoords;

    float cx = 2/scale.x, cy = 2/scale.y;
    float x = -position.x, y = -position.y, z = position.z;
    gl_Position = vec4((x-y+offset.x)*cx, (x+y+z*2)*cx*0.75-offset.y*cx, 0, 1);
}