mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-13 19:08:11 +00:00
[client] egl: move rotation into the fragment shader
This commit is contained in:
@@ -4,22 +4,40 @@ layout(location = 0) in vec3 vertexPosition_modelspace;
|
||||
layout(location = 1) in vec2 vertexUV;
|
||||
|
||||
uniform vec4 mouse;
|
||||
uniform lowp int rotate;
|
||||
|
||||
out highp vec2 uv;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position.xyz = vertexPosition_modelspace;
|
||||
gl_Position.w = 1.0;
|
||||
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;
|
||||
|
||||
gl_Position.x += 1.0f;
|
||||
gl_Position.y -= 1.0f;
|
||||
|
||||
gl_Position.x *= mouse.z;
|
||||
gl_Position.y *= mouse.w;
|
||||
|
||||
gl_Position.x += mouse.x;
|
||||
gl_Position.y -= mouse.y;
|
||||
if (rotate == 0) // up
|
||||
{
|
||||
gl_Position.xy = muv;
|
||||
}
|
||||
else if (rotate == 1) // down
|
||||
{
|
||||
gl_Position.x = -muv.x;
|
||||
gl_Position.y = -muv.y;
|
||||
}
|
||||
else if (rotate == 2) // left
|
||||
{
|
||||
gl_Position.x = -muv.y;
|
||||
gl_Position.y = muv.x;
|
||||
}
|
||||
else if (rotate == 3) // right
|
||||
{
|
||||
gl_Position.x = muv.y;
|
||||
gl_Position.y = -muv.x;
|
||||
}
|
||||
|
||||
gl_Position.w = 1.0;
|
||||
uv = vertexUV;
|
||||
}
|
||||
|
@@ -2,36 +2,15 @@
|
||||
|
||||
in highp vec2 uv;
|
||||
out highp vec4 color;
|
||||
uniform int rotate;
|
||||
|
||||
uniform sampler2D sampler1;
|
||||
|
||||
uniform lowp int rotate;
|
||||
uniform int cbMode;
|
||||
|
||||
void main()
|
||||
{
|
||||
highp vec2 ruv;
|
||||
if (rotate == 0) // up
|
||||
{
|
||||
ruv = uv;
|
||||
}
|
||||
else if (rotate == 1) // down
|
||||
{
|
||||
ruv.x = -uv.x + 1.0f;
|
||||
ruv.y = -uv.y + 1.0f;
|
||||
}
|
||||
else if (rotate == 2) // left
|
||||
{
|
||||
ruv.x = -uv.y + 1.0f;
|
||||
ruv.y = uv.x;
|
||||
}
|
||||
else if (rotate == 3) // right
|
||||
{
|
||||
ruv.x = uv.y;
|
||||
ruv.y = -uv.x + 1.0f;
|
||||
}
|
||||
|
||||
color = texture(sampler1, ruv);
|
||||
color = texture(sampler1, uv);
|
||||
|
||||
if (cbMode > 0)
|
||||
{
|
||||
|
Reference in New Issue
Block a user