2025-03-28 16:33:40 -04:00
|
|
|
#version 450
|
2025-04-01 21:41:24 -04:00
|
|
|
|
|
|
|
|
// Matches Vertex struct attribute descriptions
|
|
|
|
|
layout(location = 0) in vec3 inPosition;
|
|
|
|
|
layout(location = 1) in vec3 inColor;
|
|
|
|
|
// layout(location = 2) in vec2 inTexCoord; // If you add texture coords
|
|
|
|
|
|
|
|
|
|
// Matches UniformBufferObject struct and descriptor set layout binding
|
|
|
|
|
layout(binding = 0) uniform UniformBufferObject {
|
|
|
|
|
mat4 model;
|
|
|
|
|
mat4 view;
|
|
|
|
|
mat4 proj;
|
|
|
|
|
} ubo;
|
|
|
|
|
|
|
|
|
|
// Output to fragment shader
|
|
|
|
|
layout(location = 0) out vec3 fragColor;
|
|
|
|
|
// layout(location = 1) out vec2 fragTexCoord; // If you add texture coords
|
2025-03-28 16:33:40 -04:00
|
|
|
|
|
|
|
|
void main() {
|
2025-04-01 21:41:24 -04:00
|
|
|
// Transform position: Model -> World -> View -> Clip space
|
|
|
|
|
gl_Position = ubo.proj * ubo.view * ubo.model * vec4(inPosition, 1.0);
|
|
|
|
|
|
|
|
|
|
// Pass color (and other attributes) through
|
|
|
|
|
fragColor = inColor;
|
|
|
|
|
// fragTexCoord = inTexCoord;
|
2025-03-28 16:33:40 -04:00
|
|
|
}
|