blob: 2ee74b3eae000dc408542fa527bcb6395c7912b3 (
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
|
uniform mat4 ViewProjectionMatrix;
uniform vec3 screen_vecs[2];
/* ---- Instanciated Attribs ---- */
in vec3 pos; /* using Z as axis id */
/* ---- Per instance Attribs ---- */
in mat4 InstanceModelMatrix;
in vec3 color;
in float size;
flat out vec4 finalColor;
void main()
{
vec3 offset = vec3(0.0);
#ifdef AXIS_NAME
if (pos.z == 0.0)
offset = vec3(1.125, 0.0, 0.0);
else if (pos.z == 1.0)
offset = vec3(0.0, 1.125, 0.0);
else
offset = vec3(0.0, 0.0, 1.125);
offset *= size;
#endif
vec3 screen_pos = screen_vecs[0].xyz * pos.x + screen_vecs[1].xyz * pos.y;
gl_Position = ViewProjectionMatrix * (InstanceModelMatrix * vec4(offset, 1.0) + vec4(screen_pos * size, 0.0));
finalColor = vec4(color, 1.0);
}
|