2019-03-28 04:53:15 +00:00
|
|
|
#version 300 es
|
2021-08-11 10:41:56 +00:00
|
|
|
precision mediump float;
|
2019-03-28 04:53:15 +00:00
|
|
|
|
|
|
|
layout(location = 0) in vec3 vertexPosition_modelspace;
|
|
|
|
layout(location = 1) in vec2 vertexUV;
|
|
|
|
|
|
|
|
uniform vec4 mouse;
|
2021-08-11 10:41:56 +00:00
|
|
|
uniform int rotate;
|
2019-03-28 04:53:15 +00:00
|
|
|
|
2021-08-11 10:41:56 +00:00
|
|
|
out vec2 uv;
|
2019-03-28 04:53:15 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2021-01-15 02:13:39 +00:00
|
|
|
vec2 muv = vertexPosition_modelspace.xy;
|
|
|
|
muv.x += 1.0f;
|
|
|
|
muv.y -= 1.0f;
|
|
|
|
muv.x *= mouse.z;
|
|
|
|
muv.y *= mouse.w;
|
|
|
|
muv.x += mouse.x;
|
|
|
|
muv.y -= mouse.y;
|
|
|
|
|
2021-01-18 03:42:57 +00:00
|
|
|
if (rotate == 0) // 0
|
2021-01-15 02:13:39 +00:00
|
|
|
{
|
|
|
|
gl_Position.xy = muv;
|
|
|
|
}
|
2021-01-18 03:42:57 +00:00
|
|
|
else if (rotate == 1) // 90
|
|
|
|
{
|
|
|
|
gl_Position.x = muv.y;
|
|
|
|
gl_Position.y = -muv.x;
|
|
|
|
}
|
|
|
|
else if (rotate == 2) // 180
|
2021-01-15 02:13:39 +00:00
|
|
|
{
|
|
|
|
gl_Position.x = -muv.x;
|
|
|
|
gl_Position.y = -muv.y;
|
|
|
|
}
|
2021-01-18 03:42:57 +00:00
|
|
|
else if (rotate == 3) // 270
|
2021-01-15 02:13:39 +00:00
|
|
|
{
|
|
|
|
gl_Position.x = -muv.y;
|
|
|
|
gl_Position.y = muv.x;
|
|
|
|
}
|
|
|
|
|
|
|
|
gl_Position.w = 1.0;
|
2019-03-28 04:53:15 +00:00
|
|
|
uv = vertexUV;
|
|
|
|
}
|