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

paint_vert_frag.glsl « shaders « modes « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c22e1c04b96fbbdc8b74b7c54f38bf035b32a484 (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

flat in int finalFlag;
out vec4 fragColor;

#define VERTEX_SELECTED (1 << 0)
#define VERTEX_HIDE     (1 << 4)

void main()
{
	if (bool(finalFlag & VERTEX_HIDE)) {
		discard;
	}

	vec2 centered = gl_PointCoord - vec2(0.5);
	float dist_squared = dot(centered, centered);
	const float rad_squared = 0.25;
	const vec4 colSel = vec4(1.0, 1.0, 1.0, 1.0);
	const vec4 colUnsel = vec4(0.5, 0.5, 0.5, 1.0);

	// round point with jaggy edges
	if (dist_squared > rad_squared) {
		discard;
	}

	fragColor = bool(finalFlag & VERTEX_SELECTED) ? colSel : colUnsel;
}