diff options
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/header_330.glsl | 5 | ||||
-rw-r--r-- | shaders/header_420.glsl | 5 | ||||
-rw-r--r-- | shaders/rect.frag | 33 | ||||
-rw-r--r-- | shaders/rect.vert | 35 |
4 files changed, 0 insertions, 78 deletions
diff --git a/shaders/header_330.glsl b/shaders/header_330.glsl deleted file mode 100644 index bfe7a00..0000000 --- a/shaders/header_330.glsl +++ /dev/null @@ -1,5 +0,0 @@ -#version 330 core - -#define INTER(qualifiers) -#define UBO(qualifiers) layout(std140) - diff --git a/shaders/header_420.glsl b/shaders/header_420.glsl deleted file mode 100644 index 55fbe8a..0000000 --- a/shaders/header_420.glsl +++ /dev/null @@ -1,5 +0,0 @@ -#version 420 core - -#define INTER(qualifiers) layout(qualifiers) -#define UBO(qualifiers) layout(std140, qualifiers) - diff --git a/shaders/rect.frag b/shaders/rect.frag deleted file mode 100644 index ecec50d..0000000 --- a/shaders/rect.frag +++ /dev/null @@ -1,33 +0,0 @@ -/* The fragment shader uses the UV coordinates to calculate whether it is in - the T, R, B, or L border. These are then mixed with the border color, and - their inverse is mixed with the fill color, to calculate the fragment color. - For example, if we are in the top border, then T=1, so the border mix factor - TRBL=1, and the fill mix factor (1-TRBL) is 0. - - The use of pixel units here is handy because the border width can be - specified precisely in pixels to draw sharp lines. The border width is just - hardcoded, but could be made a uniform or vertex attribute easily enough. */ - -INTER(location = 0) noperspective in vec2 f_uv; -INTER(location = 1) noperspective in vec2 f_size; -INTER(location = 2) noperspective in vec4 f_fillColor; - -layout(location = 0) out vec4 FragColor; - -void -main() -{ - const float borderWidth = 2.0; - - vec4 borderColor = f_fillColor + vec4(0.0, 0.4, 0.4, 0.0); - float t = step(borderWidth, f_uv[1]); - float r = step(borderWidth, f_size.x - f_uv[0]); - float b = step(borderWidth, f_size.y - f_uv[1]); - float l = step(borderWidth, f_uv[0]); - float fillMix = t * r * b * l; - float borderMix = 1.0 - fillMix; - vec4 fill = fillMix * f_fillColor; - vec4 border = borderMix * borderColor; - - FragColor = fill + border; -} diff --git a/shaders/rect.vert b/shaders/rect.vert deleted file mode 100644 index 09f1917..0000000 --- a/shaders/rect.vert +++ /dev/null @@ -1,35 +0,0 @@ -/* The vertex shader is trivial, but forwards scaled UV coordinates (in pixels) - to the fragment shader for drawing the border. */ - -UBO(binding = 0) uniform UniformBufferObject -{ - mat4 projection; -} ubo; - -layout(location = 0) in vec2 v_position; -layout(location = 1) in vec2 v_origin; -layout(location = 2) in vec2 v_size; -layout(location = 3) in vec4 v_fillColor; - -INTER(location = 0) noperspective out vec2 f_uv; -INTER(location = 1) noperspective out vec2 f_size; -INTER(location = 2) noperspective out vec4 f_fillColor; - -void -main() -{ - // clang-format off - mat4 m = mat4(v_size[0], 0.0, 0.0, 0.0, - 0.0, v_size[1], 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - v_origin[0], v_origin[1], 0.0, 1.0); - // clang-format on - - mat4 MVP = ubo.projection * m; - - f_uv = v_position * v_size; - f_size = v_size; - f_fillColor = v_fillColor; - - gl_Position = MVP * vec4(v_position, 0.0, 1.0); -} |