2021-02-19 02:14:54 +00:00
|
|
|
#version 450
|
2023-01-22 08:30:25 +00:00
|
|
|
#extension GL_GOOGLE_include_directive : enable
|
2023-01-22 10:23:15 +00:00
|
|
|
#extension GL_EXT_multiview : enable
|
2021-02-19 02:14:54 +00:00
|
|
|
|
2023-01-22 08:30:25 +00:00
|
|
|
layout (set = 0, binding = 0) uniform
|
|
|
|
#include "matrices.h"
|
|
|
|
;
|
2021-02-25 04:46:33 +00:00
|
|
|
|
2021-02-19 02:14:54 +00:00
|
|
|
layout (triangles) in;
|
|
|
|
layout (triangle_strip, max_vertices = 3) out;
|
|
|
|
layout (location = 0) in vec4 v_tl_st[];
|
|
|
|
layout (location = 1) in vec3 v_direction[];
|
2022-05-26 23:12:21 +00:00
|
|
|
layout (location = 2) in vec4 v_color[];
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
layout (location = 0) out vec4 tl_st;
|
|
|
|
layout (location = 1) out vec3 direction;
|
|
|
|
layout (location = 2) out vec3 normal;
|
2021-02-25 04:46:33 +00:00
|
|
|
layout (location = 3) out vec4 position;
|
2022-05-26 23:12:21 +00:00
|
|
|
layout (location = 4) out vec4 color;
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
vec3 a = gl_in[0].gl_Position.xyz;
|
|
|
|
vec3 b = gl_in[1].gl_Position.xyz;
|
|
|
|
vec3 c = gl_in[2].gl_Position.xyz;
|
|
|
|
|
2021-02-25 04:46:33 +00:00
|
|
|
vec3 n = normalize (cross (c - a, b - a));
|
2021-02-19 02:14:54 +00:00
|
|
|
|
|
|
|
for (int vert = 0; vert < 3; vert++) {
|
2021-02-25 04:46:33 +00:00
|
|
|
vec4 p = gl_in[vert].gl_Position;
|
2023-01-22 10:23:15 +00:00
|
|
|
gl_Position = Projection3d * (View[gl_ViewIndex] * (p));
|
2021-02-19 02:14:54 +00:00
|
|
|
tl_st = v_tl_st[vert];
|
|
|
|
direction = v_direction[vert];
|
2022-05-26 23:12:21 +00:00
|
|
|
color = v_color[vert];
|
2021-02-19 02:14:54 +00:00
|
|
|
normal = n;
|
2021-02-25 04:46:33 +00:00
|
|
|
position = p;
|
2021-02-19 02:14:54 +00:00
|
|
|
EmitVertex ();
|
|
|
|
}
|
|
|
|
EndPrimitive ();
|
|
|
|
}
|