1
0
mirror of synced 2025-01-07 12:01:42 +01:00
Switch-Toolbox/Toolbox/Shader/Layout/Bflyt.vert
KillzXGaming 32fb5444e7 Add all the newest changes.
Add support for bayonetta/astral chain dat.
Add support for darc archives.
Support previewing window panes for bflyt (1 frame atm with around kind)
Add bflan reading. Saving needs more testing and will be enabled soon.
Bflyt editor will keep the editor open within an archive when saved.
A custom dialog will be added soon to customize saving parameters.
Bflims will be loaded if in the same folder as the bflyt when opened.
2019-09-10 18:42:48 -04:00

39 lines
1012 B
GLSL

uniform vec2 uvScale0;
uniform vec2 uvRotate0;
uniform vec2 uvTranslate0;
uniform int flipTexture;
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
return vec2(-1, 1) * tex + vec2(1, 0);
else if (flipTexture == 2) //FlipV
return vec2(1, -1) * tex + vec2(0, 1);
else if (flipTexture == 3) //Rotate90
return rotateUV(tex, 90.0);
else if (flipTexture == 4) //Rotate180
return rotateUV(tex, 180.0);
else if (flipTexture == 5) //Rotate270
return rotateUV(tex, 270.0);
return outTexCoord;
}
void main()
{
gl_FrontColor = gl_Color;
vec2 texCoord0 = uvScale0 * gl_MultiTexCoord0.xy + uvTranslate0;
gl_TexCoord[0].st = SetFlip(texCoord0);
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}