blob: 0a396a5325fdbf5b83d126ad64aa3b0232a31296 (
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
53
54
55
56
57
58
59
|
/* 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 ivec3 flag;
flat out vec4 faceColor;
flat out int clipCase;
#ifdef VERTEX_SELECTION
out vec3 vertexColor;
#endif
/* See fragment shader */
noperspective out vec4 eData1;
flat out vec4 eData2;
/* project to screen space */
vec2 proj(vec4 pos)
{
return (0.5 * (pos.xy / pos.w) + 0.5) * viewportSize;
}
void main()
{
clipCase = 0;
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
/* only vertex position 0 is used */
eData1 = eData2 = vec4(1e10);
eData2.zw = proj(pPos);
flag = ivec3(0);
flag[0] = (data.x << 8);
gl_PointSize = sizeEdgeFix;
gl_Position = pPos;
}
|