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

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

uniform mat4 ModelViewProjectionMatrix;

in vec3 pos;
in vec4 norAndFlag;

flat out int isSelected;

#ifdef VERTEX_FACING
uniform mat4 ProjectionMatrix;
uniform mat4 ModelViewMatrix;
uniform mat3 NormalMatrix;

flat out float facing;
#endif

void main()
{
	gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
	/* Bias Facedot Z position in clipspace. */
	gl_Position.z -= 0.0002;
	gl_PointSize = sizeFaceDot;
	isSelected = int(norAndFlag.w);
#ifdef VERTEX_FACING
	vec3 view_normal = normalize(NormalMatrix * norAndFlag.xyz);
	vec3 view_vec = (ProjectionMatrix[3][3] == 0.0)
		? normalize((ModelViewMatrix * vec4(pos, 1.0)).xyz)
		: vec3(0.0, 0.0, 1.0);
	facing = dot(view_vec, view_normal);
#endif
}