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

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

/* Solid Wirefram implementation
 * Mike Erwin, Clément Foucault */

/* This shader follows the principles of
 * http://developer.download.nvidia.com/SDK/10/direct3d/Source/SolidWireframe/Doc/SolidWireframe.pdf */

flat in vec4 faceColor;
flat in int faceActive;

out vec4 FragColor;

const vec4 stipple_matrix[4] = vec4[4](
	vec4(1.0, 0.0, 0.0, 0.0),
	vec4(0.0, 0.0, 0.0, 0.0),
	vec4(0.0, 0.0, 1.0, 0.0),
	vec4(0.0, 0.0, 0.0, 0.0)
);

void main()
{
	FragColor = faceColor;

	if (faceActive == 1) {
		int x = int(gl_FragCoord.x) & 0x3; /* mod 4 */
		int y = int(gl_FragCoord.y) & 0x3; /* mod 4 */
		FragColor *= stipple_matrix[x][y];
	}
}