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

gpu_shader_2D_widget_base_frag.glsl « shaders « gpu « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f660cae8d129faa0c1f7b82b3770dd253f8db064 (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
35
uniform vec3 checkerColorAndSize;

noperspective in vec4 finalColor;
noperspective in float butCo;

out vec4 fragColor;

vec4 do_checkerboard()
{
	float size = checkerColorAndSize.z;
	vec2 phase = mod(gl_FragCoord.xy, size * 2.0);

	if ((phase.x > size && phase.y < size) ||
		(phase.x < size && phase.y > size))
	{
		return vec4(checkerColorAndSize.xxx, 1.0);
	}
	else {
		return vec4(checkerColorAndSize.yyy, 1.0);
	}
}

void main()
{
	fragColor = finalColor;

	if (butCo > 0.5) {
		vec4 checker = do_checkerboard();
		fragColor = mix(checker, fragColor, fragColor.a);
	}

	if (butCo > 0.0) {
		fragColor.a = 1.0;
	}
}