blob: 2a328a7136668cc5d37c736b93fc80a82d4de49e (
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
60
61
62
63
64
65
66
67
68
69
70
|
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;
uniform float wireStepParam;
uniform float ofs;
#ifndef USE_SCULPT
float get_edge_sharpness(float wd)
{
return (wd == 1.0) ? 1.0 : ((wd == 0.0) ? -1.0 : (wd + wireStepParam));
}
#else
float get_edge_sharpness(float wd) { return 1.0; }
#endif
/* Geometry shader version */
#if defined(SELECT_EDGES) || defined(USE_GEOM)
in vec3 pos;
in vec3 nor;
in float wd; /* wiredata */
out float facing_g;
out float edgeSharpness_g;
void main()
{
edgeSharpness_g = get_edge_sharpness(wd);
mat4 projmat = ProjectionMatrix;
projmat[3][2] -= ofs;
gl_Position = projmat * (ModelViewMatrix * vec4(pos, 1.0));
facing_g = normalize(NormalMatrix * nor).z;
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
#endif
}
#else /* USE_GEOM */
in vec3 pos;
in vec3 nor;
in float wd;
out float facing;
flat out float edgeSharpness;
void main()
{
mat4 projmat = ProjectionMatrix;
projmat[3][2] -= ofs;
gl_Position = projmat * (ModelViewMatrix * vec4(pos, 1.0));
edgeSharpness = get_edge_sharpness(wd);
facing = normalize(NormalMatrix * nor).z;
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
#endif
}
#endif /* SELECT_EDGES */
|