mouse-shader: remove sharp cutoff in drag distortion.

This commit is contained in:
Eduard-Mihai Burtescu 2022-09-28 15:48:59 +03:00 committed by Eduard-Mihai Burtescu
parent d90274af0b
commit 5c8e65279f

View File

@ -163,7 +163,7 @@ pub fn main_fs(
let to_frag = v - from_coord(drag_start); let to_frag = v - from_coord(drag_start);
let start_to_end = from_coord(drag_end) - from_coord(drag_start); let start_to_end = from_coord(drag_end) - from_coord(drag_start);
let det = to_frag.perp_dot(start_to_end).abs(); let det = to_frag.perp_dot(start_to_end).abs();
distance /= 1.0 + det.min(1.0).powf(2.0); distance /= 1.0 + det.powf(2.0);
let t = constants.time; let t = constants.time;
let rot = move |factor: f32| { let rot = move |factor: f32| {
(Mat2::from_angle((t / 3.0 + distance * factor).sin() * 3.0) * v).normalize() (Mat2::from_angle((t / 3.0 + distance * factor).sin() * 3.0) * v).normalize()