2024-11-15 15:25:36 -05:00
|
|
|
#version 450
|
|
|
|
|
|
|
|
layout(binding = 0) uniform UniformBufferObject {
|
2024-11-15 21:25:10 -05:00
|
|
|
mat4 model;
|
|
|
|
mat4 view;
|
|
|
|
mat4 proj;
|
2024-11-15 15:25:36 -05:00
|
|
|
} ubo;
|
|
|
|
|
|
|
|
layout(location = 0) in vec3 inPosition;
|
|
|
|
layout(location = 1) in vec3 inColor;
|
|
|
|
layout(location = 2) in vec2 inTexCoord;
|
2024-11-15 21:25:10 -05:00
|
|
|
layout(location = 3) in vec3 inNormal;
|
2024-11-15 15:25:36 -05:00
|
|
|
|
|
|
|
layout(location = 0) out vec3 fragColor;
|
|
|
|
layout(location = 1) out vec2 fragTexCoord;
|
2024-11-15 21:25:10 -05:00
|
|
|
layout(location = 2) out vec3 fragNormal;
|
|
|
|
layout(location = 3) out vec3 fragWorldPos;
|
2024-11-15 15:25:36 -05:00
|
|
|
|
|
|
|
void main() {
|
2024-11-15 21:25:10 -05:00
|
|
|
vec4 worldPos = ubo.model * vec4(inPosition, 1.0);
|
|
|
|
gl_Position = ubo.proj * ubo.view * worldPos;
|
|
|
|
|
|
|
|
// Transform normal to world space
|
|
|
|
fragNormal = mat3(transpose(inverse(ubo.model))) * inNormal;
|
|
|
|
fragWorldPos = worldPos.xyz;
|
|
|
|
fragColor = inColor;
|
|
|
|
fragTexCoord = inTexCoord;
|
2024-11-15 15:25:36 -05:00
|
|
|
}
|