X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=flat_input.frag;h=78d4edd8224e4fc13e80411d51c088b5261b6d02;hp=4bc055e8baec0a00f2552cea2bc65bc732e04ad8;hb=f216b7bef5a968c89f6fc78e83cc26a91e504a8a;hpb=0dc1dfe6444a700ebd2c9f006cba000b90c3a7b0 diff --git a/flat_input.frag b/flat_input.frag index 4bc055e..78d4edd 100644 --- a/flat_input.frag +++ b/flat_input.frag @@ -1,10 +1,23 @@ -uniform sampler2D PREFIX(tex); +// Implicit uniforms: +// uniform sampler2D PREFIX(tex); vec4 FUNCNAME(vec2 tc) { // OpenGL's origin is bottom-left, but most graphics software assumes // a top-left origin. Thus, for inputs that come from the user, // we flip the y coordinate. - tc.y = 1.0f - tc.y; + tc.y = 1.0 - tc.y; - return texture2D(PREFIX(tex), tc); + vec4 pixel = tex2D(PREFIX(tex), tc); + + // These two are #defined to 0 or 1 in flat_input.cpp. +#if FIXUP_SWAP_RB + pixel.rb = pixel.br; +#endif +#if FIXUP_RED_TO_GRAYSCALE + pixel.gb = pixel.rr; +#endif + return pixel; } + +#undef FIXUP_SWAP_RB +#undef FIXUP_RED_TO_GRAYSCALE