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

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

uniform vec2 viewportSize;

in vec3 pos;
in int data;

/* these are the same for all vertices
 * and does not need interpolation */
flat out int vertFlag;
flat out int clipCase;

/* See fragment shader */
noperspective out vec4 eData1;
flat out vec4 eData2;

/* project to screen space */
vec2 proj(vec4 pos)
{
  return (0.5 * (pos.xy / pos.w) + 0.5) * viewportSize;
}

void main()
{
  GPU_INTEL_VERTEX_SHADER_WORKAROUND

  clipCase = 0;

  vec3 world_pos = point_object_to_world(pos);
  vec4 pPos = point_world_to_ndc(world_pos);

  /* only vertex position 0 is used */
  eData1 = eData2 = vec4(1e10);
  eData2.zw = proj(pPos);

  vertFlag = data;

  gl_PointSize = sizeVertex * 2.0;
  gl_Position = pPos;

#ifdef USE_WORLD_CLIP_PLANES
  world_clip_planes_calc_clip_distance(world_pos);
#endif
}