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

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

in vec3 pos;

#ifdef LOOP_NORMALS
in vec3 lnor;
#  define nor lnor

#elif defined(FACE_NORMALS)
in vec4 norAndFlag;
#  define nor norAndFlag.xyz
#else

in vec3 vnor;
#  define nor vnor
#endif

flat out vec4 v1;
flat out vec4 v2;

void main()
{
  GPU_INTEL_VERTEX_SHADER_WORKAROUND

  vec3 n = normalize(normal_object_to_world(nor));

  vec3 world_pos = point_object_to_world(pos);

  v1 = point_world_to_ndc(world_pos);
  v2 = point_world_to_ndc(world_pos + n * normalSize);

#ifdef USE_WORLD_CLIP_PLANES
  world_clip_planes_calc_clip_distance(world_pos);
#endif
}