blob: 31b359dbe6dc1b3f831057957f614f55b6a1fdf3 (
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
55
56
57
|
uniform mat4 ViewProjectionMatrix;
#ifdef USE_WORLD_CLIP_PLANES
uniform mat4 ModelMatrix;
#endif
/* ---- Instantiated Attrs ---- */
in float pos;
/* ---- Per instance Attrs ---- */
in vec3 color;
in vec4 corners[2]; /* trouble fetching vec2 */
in float depth;
in vec4 tria;
in mat4 InstanceModelMatrix;
flat out vec4 finalColor;
void main()
{
vec3 pPos;
if (pos == 1.0) {
pPos = vec3(corners[0].xy, depth);
}
else if (pos == 2.0) {
pPos = vec3(corners[0].zw, depth);
}
else if (pos == 3.0) {
pPos = vec3(corners[1].xy, depth);
}
else if (pos == 4.0) {
pPos = vec3(corners[1].zw, depth);
}
else if (pos == 5.0) {
pPos = vec3(tria.xy, depth);
}
else if (pos == 6.0) {
vec2 ofs = tria.xy - corners[0].xy;
ofs.x = -ofs.x;
pPos = vec3(corners[1].zw + ofs, depth);
}
else if (pos == 7.0) {
pPos = vec3(tria.zw, depth);
}
else {
pPos = vec3(0.0);
}
gl_Position = ViewProjectionMatrix * InstanceModelMatrix * vec4(pPos, 1.0);
finalColor = vec4(color, 1.0);
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance((ModelMatrix * InstanceModelMatrix * vec4(pPos, 1.0)).xyz);
#endif
}
|