2022-11-07 20:15:26 +00:00
|
|
|
#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;
|
2022-11-27 14:35:41 +00:00
|
|
|
vec3 lightPos = vec3(-500.0, 500.0, 40.0);
|
2022-11-07 20:15:26 +00:00
|
|
|
fragLightPos = vec3(constants.view * vec4(lightPos, 1.0));
|
|
|
|
}
|