fast-nuclear-sim/assets/shader/light.vsh

34 lines
592 B
V Shell
Raw Normal View History

2024-02-24 22:52:29 +11:00
#version 460 core
2024-03-21 01:45:08 +11:00
#define MAX_LIGHTS 6
layout (location = 1) in vec3 aPos;
layout (location = 2) in vec4 aColour;
layout (location = 6) in int aTransformIndex;
2024-02-24 22:52:29 +11:00
2024-03-06 22:32:54 +11:00
layout (binding = 3) readonly buffer TransformBuffer
{
mat4 transforms[];
};
2024-03-03 12:12:21 +11:00
out flat int should_ignore;
2024-02-25 21:54:51 +11:00
2024-03-21 01:45:08 +11:00
uniform vec3 light_pos;
uniform int light_pass;
2024-03-06 22:32:54 +11:00
mat4 load_model_mat(int index)
{
return index < 0 ? mat4(1.f) : transforms[index];
}
2024-02-24 22:52:29 +11:00
void main()
{
2024-03-06 22:32:54 +11:00
vec4 pos = vec4(aPos, 1.f);
2024-03-21 01:45:08 +11:00
mat4 model = load_model_mat(aTransformIndex);
2024-03-06 22:32:54 +11:00
2024-03-21 01:45:08 +11:00
gl_Position = model * pos - vec4(light_pos, 0.f);
should_ignore = int(aColour.a < 1.f);
2024-02-24 22:52:29 +11:00
}