SPIRV-Cross/reference/shaders/flatten/dynamic.flatten.vert

26 lines
494 B
GLSL
Raw Normal View History

2017-01-16 22:19:49 +00:00
#version 310 es
struct Light
{
vec3 Position;
float Radius;
vec4 Color;
};
uniform vec4 UBO[12];
in vec4 aVertex;
out vec4 vColor;
in vec3 aNormal;
void main()
{
gl_Position = mat4(UBO[0], UBO[1], UBO[2], UBO[3]) * aVertex;
2017-01-16 22:19:49 +00:00
vColor = vec4(0.0);
for (int i = 0; i < 4; i++)
{
vec3 L = aVertex.xyz - (UBO[i * 2 + 4].xyz);
vColor += (((UBO[i * 2 + 5]) * clamp(1.0 - (length(L) / (UBO[i * 2 + 4].w)), 0.0, 1.0)) * dot(aNormal, normalize(L)));
2017-01-16 22:19:49 +00:00
}
}