blob: a66560cd8d97a9aef39a5b9f0a6b03d3544e2a4d (
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
|
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 ModelMatrix;
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.00035;
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
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
#endif
}
|