From d974f8326e75fa53d6be1377db8d0db24ec54dde Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 8 Feb 2023 03:37:58 +0100 Subject: [PATCH] shaders for progressbar --- kubi/shaders/gui/progress.frag | 15 +++++++++++++++ kubi/shaders/gui/progress.vert | 13 +++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 kubi/shaders/gui/progress.frag create mode 100644 kubi/shaders/gui/progress.vert diff --git a/kubi/shaders/gui/progress.frag b/kubi/shaders/gui/progress.frag new file mode 100644 index 0000000..1474e79 --- /dev/null +++ b/kubi/shaders/gui/progress.frag @@ -0,0 +1,15 @@ +#version 150 core + +in vec2 v_uv; +out vec4 out_color; +uniform float progress; +uniform vec4 color; +uniform vec4 bg_color; + +void main() { + if (v_uv.x <= progress) { + out_color = color; + } else { + out_color = bg_color; + } +} diff --git a/kubi/shaders/gui/progress.vert b/kubi/shaders/gui/progress.vert new file mode 100644 index 0000000..82ad5d7 --- /dev/null +++ b/kubi/shaders/gui/progress.vert @@ -0,0 +1,13 @@ +#version 150 core + +in vec2 position; +in vec2 uv; +out vec2 v_uv; +uniform vec2 ui_scale; +uniform vec2 element_position; +uniform vec2 element_size; + +void main() { + v_uv = uv; + gl_Position = vec4(ui_scale * (element_position + (position * element_size)), 0.0, 1.0); +}