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

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

uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat4 ModelMatrix;
uniform mat3 NormalMatrix;

uniform float wireStepParam;
uniform float ofs;

float get_edge_sharpness(float wd)
{
	return (wd == 1.0) ? 1.0 : ((wd == 0.0) ? -1.0 : (wd + wireStepParam));
}

/* Geometry shader version */
#if defined(SELECT_EDGES) || defined(USE_SCULPT)

in vec3 pos;
in vec3 nor;
in float wd; /* wiredata */

out float facing_g;
out float edgeSharpness_g;

void main()
{
#  ifndef USE_SCULPT
	edgeSharpness_g = get_edge_sharpness(wd);
#  else
	/* TODO approximation using normals. */
	edgeSharpness_g = 1.0;
#  endif

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

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