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

edit_mesh_overlay_loosevert_vert.glsl « shaders « modes « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 13d824c24101bb424b73216734a3fc7b43f354f2 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

/* 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 */

uniform mat4 ModelViewProjectionMatrix;
uniform vec2 viewportSize;

in vec3 pos;
in ivec4 data;

/* these are the same for all vertices
 * and does not need interpolation */
flat out vec3 edgesCrease;
flat out vec3 edgesBweight;
flat out vec4 faceColor;
flat out ivec3 flag;
#ifdef VERTEX_SELECTION
out vec3 vertexColor;
#endif

/* See fragment shader */
flat out vec2 ssPos[3];

/* project to screen space */
vec2 proj(vec4 pos)
{
	return (0.5 * (pos.xy / pos.w) + 0.5) * viewportSize;
}

void main()
{
	edgesCrease = vec3(0.0);
	edgesBweight = vec3(0.0);

	vec4 pPos = ModelViewProjectionMatrix * vec4(pos, 1.0);

	/* there is no face */
	faceColor = vec4(0.0);

#ifdef VERTEX_SELECTION
	vertexColor = vec3(0.0);
#endif

	ssPos[0] = ssPos[1] = ssPos[2] = proj(pPos);
	flag[0] = flag[1] = flag[2] = (data.x << 8);

	gl_PointSize = sizeEdgeFix;
	gl_Position = pPos;
}