mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 13:01:19 +00:00
30 lines
800 B
GLSL
30 lines
800 B
GLSL
#version 450
|
|
|
|
layout(binding = 0) uniform UBO {
|
|
mat4 proj;
|
|
} ubo;
|
|
|
|
layout( push_constant ) uniform Constants {
|
|
mat4 model;
|
|
mat4 view;
|
|
} constants;
|
|
|
|
layout(location = 0) in vec3 inPosition;
|
|
layout(location = 1) in vec3 inNorm;
|
|
layout(location = 2) in vec2 inUV;
|
|
|
|
layout(location = 0) out vec3 fragPos;
|
|
layout(location = 1) out vec3 fragNorm;
|
|
layout(location = 2) out vec2 fragUV;
|
|
layout(location = 3) out vec3 fragLightPos;
|
|
|
|
void main() {
|
|
gl_Position = ubo.proj * constants.view * constants.model * vec4(inPosition, 1.0);
|
|
fragPos = vec3(constants.view * constants.model * vec4(inPosition, 1.0));
|
|
fragNorm = mat3(transpose(inverse(constants.view * constants.model))) * inNorm;
|
|
fragUV = inUV;
|
|
vec3 lightPos = vec3(-5.0, 20.0, 5.0);
|
|
fragLightPos = vec3(constants.view * vec4(lightPos, 1.0));
|
|
}
|
|
|