From 50ef5c2d1e0574f4351e4ab1cbea95907d1cd003 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 9 Feb 2023 04:16:02 +0100 Subject: [PATCH] ui transform works --- kubi/shaders/gui/progressbar.vert | 13 ++----------- kubi/src/gui.rs | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/kubi/shaders/gui/progressbar.vert b/kubi/shaders/gui/progressbar.vert index 8ae28dd..35ca9c7 100644 --- a/kubi/shaders/gui/progressbar.vert +++ b/kubi/shaders/gui/progressbar.vert @@ -5,17 +5,8 @@ out vec2 uv; uniform mat4 ui_view; uniform mat3 transform; -//not sure if mat4(i) does the same thing -mat4 extend(mat3 i) { - mat4 o; - o[0] = vec4(i[0].xyz, 0); - o[1] = vec4(i[1].xyz, 0); - o[2] = vec4(i[2].xyz, 0); - o[3] = vec4(0, 0, 0, 1); - return o; -} - void main() { uv = position; - gl_Position = ui_view * extend(transform) * vec4(position, 0., 1.); + vec2 transformed = (transform * vec3(position, 1.)).xy; + gl_Position = ui_view * vec4(transformed, 0., 1.); } diff --git a/kubi/src/gui.rs b/kubi/src/gui.rs index cbc5017..41069ba 100644 --- a/kubi/src/gui.rs +++ b/kubi/src/gui.rs @@ -50,7 +50,7 @@ pub fn gui_testing( Transform2d(Mat3::from_scale_angle_translation( vec2(0.25, 0.05), 0., - vec2(0.5, 0.) + vec2(0.5, 0.25) )), ProgressbarComponent { progress: 0.5