geometra/assets/shaders/polygon.vert

19 lines
399 B
GLSL

#version 150 core
uniform ivec2 Viewport;
uniform mat3 Transform;
uniform vec4 BoundingBox;
uniform int Border;
in vec2 Vert;
in vec2 Norm;
void main() {
vec2 vert = mix(BoundingBox.xy, BoundingBox.zw, Vert) + Border * Norm;
vec3 pos = Transform * vec3(vert, 1.0);
gl_Position.xy = pos.xy * vec2(2.0, -2.0) / Viewport + vec2(-1.0, 1.0);
gl_Position.z = 0.0;
gl_Position.w = 1.0;
}