2024-08-30 01:46:46 +00:00
|
|
|
out vec2 uv;
|
2023-09-10 14:46:07 +00:00
|
|
|
|
|
|
|
void main() {
|
2024-08-30 01:46:46 +00:00
|
|
|
// Calculate vertex position based on gl_VertexID
|
|
|
|
vec2 positions[6] = vec2[6](
|
|
|
|
vec2(-1.0, 1.0), // Top-left
|
|
|
|
vec2( 1.0, 1.0), // Top-right
|
|
|
|
vec2( 1.0, -1.0), // Bottom-right
|
|
|
|
vec2( 1.0, -1.0), // Bottom-right (repeated)
|
|
|
|
vec2(-1.0, -1.0), // Bottom-left
|
|
|
|
vec2(-1.0, 1.0) // Top-left (repeated)
|
|
|
|
);
|
|
|
|
|
|
|
|
// Calculate UV coordinates based on gl_VertexID
|
|
|
|
vec2 texCoords[6] = vec2[6](
|
|
|
|
vec2(0.0, 1.0), // Top-left
|
|
|
|
vec2(1.0, 1.0), // Top-right
|
|
|
|
vec2(1.0, 0.0), // Bottom-right
|
|
|
|
vec2(1.0, 0.0), // Bottom-right (repeated)
|
|
|
|
vec2(0.0, 0.0), // Bottom-left
|
|
|
|
vec2(0.0, 1.0) // Top-left (repeated)
|
|
|
|
);
|
|
|
|
|
|
|
|
gl_Position = vec4(positions[gl_VertexID], 0.0, 1.0);
|
|
|
|
uv = texCoords[gl_VertexID];
|
2023-09-10 14:46:07 +00:00
|
|
|
}
|