Cubyz/assets/cubyz/shaders/ui/button.vert
IntegratedQuantum c04819c5af
Compile shaders in the CI, to validate that their syntax is correct (#1427)
* Move to glslang's convention for shader file suffix

* Update ci.yml

* Oops, a mistake in the shader, how could that happen?

* Does the command error on its own?

* Update ci.yml

* Revert "Oops, a mistake in the shader, how could that happen?"

This reverts commit 869c3323f3d3b5fa607b40e7847c389a12b01f33.

* Update ci.yml
2025-05-10 12:32:51 +02:00

27 lines
716 B
GLSL

#version 460
layout(location = 0) in vec2 vertex_pos;
layout(location = 0) out vec2 startCoord;
layout(location = 1) flat out vec4 fColor;
//in pixel
layout(location = 0) uniform vec2 start;
layout(location = 1) uniform vec2 size;
layout(location = 2) uniform vec2 screen;
layout(location = 3) uniform int color;
void main() {
// Convert to opengl coordinates:
vec2 position_percentage = (start + vertex_pos*size)/screen;
startCoord.x = start.x;
startCoord.y = screen.y - start.y;
vec2 position = vec2(position_percentage.x, -position_percentage.y)*2+vec2(-1, 1);
gl_Position = vec4(position, 0, 1);
fColor = vec4((color & 0xff0000)>>16, (color & 0xff00)>>8, color & 0xff, (color>>24) & 255)/255.0;
}