Debian Codegraph @

third_party/spirv-cross/reference/shaders/flatten/copy.flatten.vert

raw
1 #version 310 es
2
3 struct Light
4 {
5 vec3 Position;
6 float Radius;
7 vec4 Color;
8 };
9
10 uniform vec4 UBO[12];
11 layout(location = 0) in vec4 aVertex;
12 layout(location = 0) out vec4 vColor;
13 layout(location = 1) in vec3 aNormal;
14
15 void main()
16 {
17 gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
18 vColor = vec4(0.0);
19 Light light;
20 for (int i = 0; i < 4; i++)
21 {
22 Light _52 = Light(UBO[i * 2 + 4].xyz, UBO[i * 2 + 4].w, UBO[i * 2 + 5]);
23 light.Position = _52.Position;
24 light.Radius = _52.Radius;
25 light.Color = _52.Color;
26 vec3 L = aVertex.xyz - light.Position;
27 vColor += ((UBO[i * 2 + 5] * clamp(1.0 - (length(L) / light.Radius), 0.0, 1.0)) * dot(aNormal, normalize(L)));
28 }
29 }
30