summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/shaders/vertex.glsl
blob: 815145461e624461d42da73cdd5cf04a8231b24a (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
in vec3 position;

#ifdef NORMAL
in vec3 normal;
#endif

#ifdef EXPLICIT_COLOR
in uint color;
#endif

#ifdef WIDTH
in float width;
#endif

in int material;

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

out vec3 ViewPosition;
#ifdef NORMAL
out vec3 Normal;
#endif
    
#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;
#ifdef NORMAL
  Normal=(normMat*vec4(normal,0)).xyz;
#endif

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

#ifdef WIDTH
  gl_PointSize=width;
#endif

  materialIndex=material;
}