fix nametag depth culling as well as a tweak to maybe make the main menu not flicker on intel iGPU

This commit is contained in:
Imbris 2021-02-06 13:32:37 -05:00
parent 3b1ea02bc5
commit 6ebbbd408d
2 changed files with 5 additions and 5 deletions

View File

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

View File

@ -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();