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

33 lines
614 B
V Shell
Raw Normal View History

2024-02-24 22:52:29 +11:00
#version 460 core
2024-03-06 22:32:54 +11:00
layout (location = 2) in vec3 aPos;
2024-02-29 15:30:50 +11:00
layout (location = 4) in vec4 aColour;
2024-02-25 21:54:51 +11:00
layout (location = 5) in vec3 aMaterial;
2024-03-03 12:12:21 +11:00
layout (location = 6) in float 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-02-24 22:52:29 +11:00
uniform mat4 camera;
2024-03-03 12:12:21 +11:00
out flat int should_ignore;
2024-02-25 21:54:51 +11:00
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);
mat4 model = load_model_mat(int(aTransformIndex));
mat4 mv = camera * model;
gl_Position = mv * pos;
should_ignore = int(aMaterial[2] > 0.f || aColour.a < 1.f);
2024-02-24 22:52:29 +11:00
}