ui transform works

This commit is contained in:
griffi-gh 2023-02-09 04:16:02 +01:00
parent e75693926a
commit 50ef5c2d1e
2 changed files with 3 additions and 12 deletions

View file

@ -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.);
}

View file

@ -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