File: flat_input.frag

package info (click to toggle)
movit 1.7.2-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,248 kB
  • sloc: cpp: 16,677; sh: 3,940; makefile: 167
file content (23 lines) | stat: -rw-r--r-- 536 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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.0 - tc.y;

	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