ptk/shaders/shader.vert.glsl

27 lines
684 B
Text
Raw Normal View History

2024-08-08 14:38:43 +02:00
#version 450
layout(binding = 0) uniform UniformBufferObject {
2024-08-08 16:26:45 +02:00
vec2 initialWindowSize;
2024-08-08 14:38:43 +02:00
vec2 windowSize;
} ubo;
layout(location = 0) in vec2 inPosition;
layout(location = 1) in vec3 inColor;
layout(location = 2) in int inShapeType;
layout(location = 3) in vec2 inUv;
2024-08-08 14:38:43 +02:00
layout(location = 0) out vec2 outPosition;
layout(location = 1) out vec3 fragColor;
layout(location = 2) out int outShapeType;
layout(location = 3) out vec2 outUv;
2024-08-08 14:38:43 +02:00
void main() {
2024-08-08 16:26:45 +02:00
vec2 normalized = ((inPosition / ubo.initialWindowSize) - 0.5) * 2.0;
gl_Position = vec4(normalized, 0.0, 1.0);
2024-08-08 14:38:43 +02:00
fragColor = inColor;
2024-08-08 16:26:45 +02:00
outPosition = normalized;
outShapeType = inShapeType;
outUv = inUv;
2024-08-08 14:38:43 +02:00
}