2020-12-23 02:40:36 +01:00
|
|
|
|
uniform int flipTexture;
|
2019-09-28 23:27:48 +02:00
|
|
|
|
uniform mat4 rotationMatrix;
|
|
|
|
|
uniform int texCoords0GenType;
|
|
|
|
|
uniform int texCoords0Source;
|
2020-02-12 22:56:16 +01:00
|
|
|
|
uniform mat4 textureTransforms[3];
|
2019-09-13 00:52:47 +02:00
|
|
|
|
|
|
|
|
|
vec2 rotateUV(vec2 uv, float rotation)
|
|
|
|
|
{
|
|
|
|
|
float mid = 0.5;
|
|
|
|
|
return vec2(
|
|
|
|
|
cos(rotation) * (uv.x - mid) + sin(rotation) * (uv.y - mid) + mid,
|
|
|
|
|
cos(rotation) * (uv.y - mid) - sin(rotation) * (uv.x - mid) + mid
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vec2 SetFlip(vec2 tex)
|
|
|
|
|
{
|
|
|
|
|
vec2 outTexCoord = tex;
|
|
|
|
|
|
|
|
|
|
if (flipTexture == 1) //FlipH
|
2020-12-23 02:40:36 +01:00
|
|
|
|
return vec2(-1.0, 1.0) * tex + vec2(1.0, 0.0);
|
2019-09-13 00:52:47 +02:00
|
|
|
|
else if (flipTexture == 2) //FlipV
|
2020-12-23 02:40:36 +01:00
|
|
|
|
return vec2(1.0, -1.0) * tex + vec2(0.0, 1.0);
|
2019-09-13 00:52:47 +02:00
|
|
|
|
else if (flipTexture == 3) //Rotate90
|
2020-12-23 02:40:36 +01:00
|
|
|
|
return rotateUV(tex, radians(90.0));
|
2019-09-13 00:52:47 +02:00
|
|
|
|
else if (flipTexture == 4) //Rotate180
|
2020-12-23 02:40:36 +01:00
|
|
|
|
return rotateUV(tex, radians(180.0));
|
2019-09-13 00:52:47 +02:00
|
|
|
|
else if (flipTexture == 5) //Rotate270
|
2020-12-23 02:40:36 +01:00
|
|
|
|
return rotateUV(tex, radians(270.0));
|
|
|
|
|
|
2019-09-13 00:52:47 +02:00
|
|
|
|
return outTexCoord;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-28 23:27:48 +02:00
|
|
|
|
vec2 SetTexCoordType(int type, vec2 tex)
|
|
|
|
|
{
|
|
|
|
|
vec2 outTexCoord = tex;
|
2020-02-03 23:17:49 +01:00
|
|
|
|
if (type == 0) return tex; //Tex0
|
|
|
|
|
if (type == 1) return tex; //Tex1
|
2020-12-23 02:40:36 +01:00
|
|
|
|
if (type == 2) return tex; //Tex2
|
2020-02-03 23:17:49 +01:00
|
|
|
|
if (type == 3) return tex; //Ortho
|
|
|
|
|
if (type == 4) return tex; //Pane based
|
|
|
|
|
if (type == 5) return tex; //Proj
|
2019-09-28 23:27:48 +02:00
|
|
|
|
return outTexCoord;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-13 00:52:47 +02:00
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
gl_FrontColor = gl_Color;
|
2020-02-12 22:56:16 +01:00
|
|
|
|
gl_TexCoord[0] = textureTransforms[0] * gl_MultiTexCoord0;
|
|
|
|
|
gl_TexCoord[0].st = SetFlip(vec2(0.5, 0.5) + gl_TexCoord[0].st);
|
2019-10-16 01:26:58 +02:00
|
|
|
|
|
2019-09-28 23:27:48 +02:00
|
|
|
|
gl_Position = gl_ModelViewProjectionMatrix * rotationMatrix * gl_Vertex;
|
2019-09-13 00:52:47 +02:00
|
|
|
|
}
|