From f307037a50cfcec9986c5d48cc5c62f6eadc0353 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sat, 6 Feb 2021 13:32:37 -0500 Subject: [PATCH] fix nametag depth culling as well as a tweak to maybe make the main menu not flicker on intel iGPU --- assets/voxygen/shaders/ui-vert.glsl | 8 ++++---- voxygen/src/ui/mod.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/voxygen/shaders/ui-vert.glsl b/assets/voxygen/shaders/ui-vert.glsl index d8eb3d6b56..c1042b7f99 100644 --- a/assets/voxygen/shaders/ui-vert.glsl +++ b/assets/voxygen/shaders/ui-vert.glsl @@ -33,10 +33,10 @@ void main() { f_uv = v_uv; // Fixed scale In-game element vec4 projected_pos = /*proj_mat * view_mat*/all_mat * vec4(w_pos.xyz - focus_off.xyz, 1.0); - gl_Position = vec4(projected_pos.xy / projected_pos.w + v_pos/* * projected_pos.w*/, 0.0, /*projected_pos.w*/1.0); + gl_Position = vec4(projected_pos.xy / projected_pos.w + v_pos/* * projected_pos.w*/, 0.5, /*projected_pos.w*/1.0); } else if (v_mode == uint(3)) { // HACK: North facing source rectangle. - gl_Position = vec4(v_pos, 0.0, 1.0); + gl_Position = vec4(v_pos, 0.5, 1.0); vec2 look_at_dir = normalize(vec2(-view_mat[0][2], -view_mat[1][2])); // TODO: Consider cleaning up matrix to something more efficient (e.g. a mat3). vec2 aspect_ratio = textureSize(sampler2D(t_tex, s_tex), 0).yx; @@ -53,11 +53,11 @@ void main() { mat2 look_at = mat2(look_at_dir.y, -look_at_dir.x, look_at_dir.x, look_at_dir.y); vec2 v_centered = (v_pos - v_center) / aspect_ratio; vec2 v_rotated = look_at * v_centered; - gl_Position = vec4(aspect_ratio * v_rotated + v_center, 0.0, 1.0); + gl_Position = vec4(aspect_ratio * v_rotated + v_center, 0.5, 1.0); } else { // Interface element f_uv = v_uv; - gl_Position = vec4(v_pos, 0.0, 1.0); + gl_Position = vec4(v_pos, 0.5, 1.0); } f_mode = v_mode; } diff --git a/voxygen/src/ui/mod.rs b/voxygen/src/ui/mod.rs index 87bf14b0d6..49426d119f 100644 --- a/voxygen/src/ui/mod.rs +++ b/voxygen/src/ui/mod.rs @@ -927,7 +927,7 @@ impl Ui { let pos_on_screen = (view_projection_mat * Vec4::from_point(parameters.pos)) .homogenized(); - let visible = if pos_on_screen.z > -1.0 && pos_on_screen.z < 1.0 { + let visible = if pos_on_screen.z > 0.0 && pos_on_screen.z < 1.0 { let x = pos_on_screen.x; let y = pos_on_screen.y; let (w, h) = parameters.dims.into_tuple();