2019-01-23 01:34:11 +03:00
|
|
|
#version 140
|
|
|
|
|
2019-01-23 04:17:14 +03:00
|
|
|
// (x offset, y offset, zoom)
|
|
|
|
uniform vec3 transform;
|
2019-05-13 02:40:52 +03:00
|
|
|
// (window width, window height, hatching == 1.0)
|
|
|
|
uniform vec3 window;
|
2019-01-23 01:34:11 +03:00
|
|
|
|
|
|
|
in vec2 position;
|
|
|
|
in vec4 color;
|
|
|
|
out vec4 pass_color;
|
|
|
|
|
|
|
|
void main() {
|
2019-02-12 00:47:34 +03:00
|
|
|
pass_color = color / 255.0;
|
2019-01-23 01:34:11 +03:00
|
|
|
|
2019-01-23 04:17:14 +03:00
|
|
|
// This is map_to_screen
|
|
|
|
float screen_x = (position[0] * transform[2]) - transform[0];
|
|
|
|
float screen_y = (position[1] * transform[2]) - transform[1];
|
|
|
|
// Translate that to clip-space or whatever it's called
|
2019-03-18 22:20:40 +03:00
|
|
|
float x = (screen_x / window[0] * 2.0) - 1.0;
|
|
|
|
float y = (screen_y / window[1] * 2.0) - 1.0;
|
2019-01-23 04:48:49 +03:00
|
|
|
// Note the y inversion
|
|
|
|
gl_Position = vec4(x, -y, 0.0, 1.0);
|
2019-01-23 01:34:11 +03:00
|
|
|
}
|