summaryrefslogtreecommitdiff
path: root/graphics/asymptote/base/shaders/vertex.glsl
blob: 42623ccef6e756a5535890f615b94fef842ea583 (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
in vec3 position;

#ifdef NORMAL

#ifndef ORTHOGRAPHIC
uniform mat4 viewMat;
out vec3 ViewPosition;
#endif

uniform mat3 normMat;
in vec3 normal;
out vec3 Normal;

#endif

#ifdef MATERIAL
in int material;
flat out int materialIndex;
#endif

#ifdef COLOR
in vec4 color;
out vec4 Color;
#endif

#ifdef WIDTH
in float width;
#endif

uniform mat4 projViewMat;

void main()
{
  vec4 v=vec4(position,1.0);
  gl_Position=projViewMat*v;
#ifdef NORMAL
#ifndef ORTHOGRAPHIC
  ViewPosition=(viewMat*v).xyz;
#endif
  Normal=normalize(normal*normMat);
#endif

#ifdef COLOR
  Color=color;
#endif

#ifdef WIDTH
  gl_PointSize=width;
#endif

#ifdef MATERIAL
  materialIndex=material;
#endif
}