summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/asymptote/shaders/vertex.glsl
blob: 9e3feda6988177cf396e03d6061e53a2574ccbb3 (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
in vec3 position;
in vec3 normal;

#ifdef EXPLICIT_COLOR
in uint color;
#endif

in int material;

uniform mat4 projViewMat;
uniform mat4 viewMat;
uniform mat4 normMat;

out vec3 ViewPosition;
out vec3 Normal;
    
#ifdef EXPLICIT_COLOR
out vec4 Color;
#endif

flat out int materialIndex;

void main()
{
  gl_Position=projViewMat*vec4(position,1.0);
  ViewPosition=(viewMat*vec4(position,1.0)).xyz;
  Normal=normalize((normMat*vec4(normal,0)).xyz);

#ifdef EXPLICIT_COLOR
  Color=unpackUnorm4x8(color);
#endif

  materialIndex=material;
}