Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gpu_shader_image_interlace_frag.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d95645f58e5963a239961c4c3daf51bda46b9a43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

/* Keep these in sync with GPU_shader.h */
#define INTERLACE_ROW                      0
#define INTERLACE_COLUMN                   1
#define INTERLACE_CHECKERBOARD             2

in vec2 texCoord_interp;
out vec4 fragColor;

uniform int interlace_id;
uniform sampler2D image_a;
uniform sampler2D image_b;

bool interlace()
{
	if (interlace_id == INTERLACE_CHECKERBOARD) {
		return (int(gl_FragCoord.x + gl_FragCoord.y) & 1) != 0;
	}
	else if (interlace_id == INTERLACE_ROW) {
		return (int(gl_FragCoord.y) & 1) != 0;
	}
	else if (interlace_id == INTERLACE_COLUMN) {
		return (int(gl_FragCoord.x) & 1) != 0;
	}
}

void main()
{
	if (interlace()) {
		fragColor = texture(image_a, texCoord_interp);
	} else {
		fragColor = texture(image_b, texCoord_interp);
	}
}