rendered paste bodyvec4 unionJack(void)
{
// first lets mirror the tcoord
vec2 tc = TexCoord0;
vec4 retCol = vec4(1.0, 1.0, 1.0, 1.0);
bool flipx = false, flipy=false;
if (tc.x > 0.5)
{
tc.x = 1.0 - tc.x;
flipx = true;
}
if (tc.y > 0.5)
{
tc.y = 1.0 - tc.y;
flipy = true;
}
// england- st george
bool george = (tc.x > 0.45) || (tc.y > 0.39);
// scotland- st andrew
bool andrew = (tc.x + 0.112 < tc.y ) || (tc.x - 0.112 > tc.y);
// clipping filter
bool andrewfilter = (tc.x < 0.41) && (tc.y < 0.32);
// ireland- st paddy split into 2 parts
bool patrick1 = (tc.x - 0.08 < tc.y ) && (tc.x > tc.y) && andrewfilter;
bool patrick2 = (tc.x + 0.08 > tc.y) && (tc.x < tc.y) && andrewfilter;
// only show part of paddy depending on which corner we're in
bool patrick = (flipy && flipx && patrick1)
|| (flipy && !flipx && patrick2)
|| (!flipy && flipx && patrick2)
|| (!flipy && !flipx && patrick1);
// red
if (george || patrick)
retCol = vec4(1.0, 0.0, 0.0, 1.0);
// blue
if (andrew && andrewfilter)
retCol = vec4(0.0, 0.0, 1.0, 1.0);
// white
return retCol;
}