summaryrefslogtreecommitdiffhomepage
path: root/shaders/shader.vert
blob: a2deda52cac4c52c795ec13ec501a770bccadbb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
precision highp float;

layout (location = 0) uniform vec2 scale;
layout (location = 1) uniform vec3 offset;
layout (location = 2) uniform vec4 tint;
layout (location = 3) uniform bool enable_lightmap;

layout (location = 0) in vec4 position; // todo move depth to .w
layout (location = 1) in vec2 texcoords;
layout (location = 2) in vec2 light_coord;
layout (location = 3) in float depth;

layout (location = 0) noperspective out vec2 frag_texcoords;
layout (location = 1) noperspective out vec2 frag_light_coord;

void main() {
    float x = -position.y, y = -position.x, z = position.z;
    gl_Position = vec4((x-y+offset.x)*scale.x, ((x+y+z*2)*0.578125-offset.y)*scale.y, offset.z + depth, 1);
    frag_texcoords = texcoords;
    frag_light_coord = light_coord;
}