31 lines
791 B
GLSL
31 lines
791 B
GLSL
#version 450
|
|
|
|
layout(location = 0) in vec2 inPosition;
|
|
layout(location = 1) in vec4 inColor;
|
|
layout(location = 2) in vec2 inTexCoord;
|
|
|
|
layout(location = 0) out vec4 fragColor;
|
|
layout(location = 1) out vec2 fragTexCoord;
|
|
|
|
layout(binding = 0) uniform UniformBufferObject {
|
|
float time;
|
|
vec2 resolution;
|
|
float rotation;
|
|
float wavePhase;
|
|
} ubo;
|
|
|
|
void main() {
|
|
// Transform position from pixel coordinates to normalized device coordinates
|
|
vec2 pos = inPosition;
|
|
|
|
// Convert to NDC: (0, 0) to (width, height) -> (-1, -1) to (1, 1)
|
|
vec2 ndc = (pos / ubo.resolution) * 2.0 - 1.0;
|
|
|
|
// Flip Y axis (Vulkan has Y down, we want Y up for easier math)
|
|
ndc.y = -ndc.y;
|
|
|
|
gl_Position = vec4(ndc, 0.0, 1.0);
|
|
fragColor = inColor;
|
|
fragTexCoord = inTexCoord;
|
|
}
|