From fdd8d4252c60b055cac2d792b414ba15046d484d Mon Sep 17 00:00:00 2001 From: lizzie Date: Tue, 8 Sep 2026 20:39:39 +0200 Subject: [common] remove unused vector_math.h fluff (#4333) Signed-off-by: lizzie - [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions). - [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md) - [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability. ------------------- We don't use half of this file for anything -- it's dead code also the NEON intrinsic replacements suck -- we are not beating GLM (plus we use registers for decomposition instead of using vec regs like everyone else does, so the "optimizations" dont matter) Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4333 Reviewed-by: CamilleLaVey Reviewed-by: Maufeat --- src/input_common/drivers/mouse.cpp | 79 +++++++++++++++++--------------------- src/input_common/drivers/mouse.h | 10 ++--- 2 files changed, 41 insertions(+), 48 deletions(-) (limited to 'src/input_common') diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index 00b7220c1e..4444f0ac3b 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -88,8 +88,8 @@ void Mouse::UpdateStickInput() { last_mouse_change *= maximum_stick_range; } - SetAxis(identifier, mouse_axis_x, last_mouse_change.x); - SetAxis(identifier, mouse_axis_y, -last_mouse_change.y); + SetAxis(identifier, mouse_axis_x, last_mouse_change[0]); + SetAxis(identifier, mouse_axis_y, -last_mouse_change[1]); // Decay input over time const float clamped_length = (std::min)(1.0f, length); @@ -104,20 +104,20 @@ void Mouse::UpdateMotionInput() { const float sensitivity = IsMousePanningEnabled() ? default_motion_panning_sensitivity : default_motion_sensitivity; - const float rotation_velocity = std::sqrt(last_motion_change.x * last_motion_change.x + - last_motion_change.y * last_motion_change.y); + const float rotation_velocity = std::sqrt(last_motion_change[0] * last_motion_change[0] + + last_motion_change[1] * last_motion_change[1]); // Clamp rotation speed if (rotation_velocity > maximum_rotation_speed / sensitivity) { const float multiplier = maximum_rotation_speed / rotation_velocity / sensitivity; - last_motion_change.x = last_motion_change.x * multiplier; - last_motion_change.y = last_motion_change.y * multiplier; + last_motion_change[0] = last_motion_change[0] * multiplier; + last_motion_change[1] = last_motion_change[1] * multiplier; } const BasicMotion motion_data{ - .gyro_x = last_motion_change.x * sensitivity, - .gyro_y = last_motion_change.y * sensitivity, - .gyro_z = last_motion_change.z * sensitivity, + .gyro_x = last_motion_change[0] * sensitivity, + .gyro_y = last_motion_change[1] * sensitivity, + .gyro_z = last_motion_change[2] * sensitivity, .accel_x = 0, .accel_y = 0, .accel_z = 0, @@ -125,53 +125,46 @@ void Mouse::UpdateMotionInput() { }; if (IsMousePanningEnabled()) { - last_motion_change.x = 0; - last_motion_change.y = 0; + last_motion_change[0] = 0; + last_motion_change[1] = 0; } - last_motion_change.z = 0; + last_motion_change[2] = 0; SetMotion(motion_identifier, 0, motion_data); } void Mouse::Move(int x, int y, int center_x, int center_y) { if (IsMousePanningEnabled()) { - const auto mouse_change = - (Common::MakeVec(x, y) - Common::MakeVec(center_x, center_y)).Cast(); - const float x_sensitivity = - Settings::values.mouse_panning_x_sensitivity.GetValue() * default_panning_sensitivity; - const float y_sensitivity = - Settings::values.mouse_panning_y_sensitivity.GetValue() * default_panning_sensitivity; - const float deadzone_counterweight = - Settings::values.mouse_panning_deadzone_counterweight.GetValue() * - default_deadzone_counterweight; - - last_motion_change += {-mouse_change.y * x_sensitivity, -mouse_change.x * y_sensitivity, 0}; - last_mouse_change.x += mouse_change.x * x_sensitivity; - last_mouse_change.y += mouse_change.y * y_sensitivity; - - // Bind the mouse change to [0 <= deadzone_counterweight <= 1.0] + auto const mouse_change_int = Common::Vec(x, y) - Common::Vec(center_x, center_y); + auto const mouse_change = Common::Vec(float(mouse_change_int[0]), float(mouse_change_int[1])); + auto const x_sensitivity = Settings::values.mouse_panning_x_sensitivity.GetValue() * default_panning_sensitivity; + auto const y_sensitivity = Settings::values.mouse_panning_y_sensitivity.GetValue() * default_panning_sensitivity; + auto const deadzone_cw = Settings::values.mouse_panning_deadzone_counterweight.GetValue() * default_deadzone_counterweight; + last_motion_change += {-mouse_change[1] * x_sensitivity, -mouse_change[0] * y_sensitivity, 0}; + last_mouse_change[0] += mouse_change[0] * x_sensitivity; + last_mouse_change[1] += mouse_change[1] * y_sensitivity; + // Bind the mouse change to [0 <= deadzone_cw <= 1.0] const float length = last_mouse_change.Length(); - if (length < deadzone_counterweight && length != 0.0f) { + if (length < deadzone_cw && length != 0.0f) { last_mouse_change /= length; - last_mouse_change *= deadzone_counterweight; + last_mouse_change *= deadzone_cw; } - return; } if (button_pressed) { - const auto mouse_move = Common::MakeVec(x, y) - mouse_origin; + const auto mouse_move = Common::Vec(x, y) - mouse_origin; const float x_sensitivity = Settings::values.mouse_panning_x_sensitivity.GetValue() * default_stick_sensitivity; const float y_sensitivity = Settings::values.mouse_panning_y_sensitivity.GetValue() * default_stick_sensitivity; - SetAxis(identifier, mouse_axis_x, static_cast(mouse_move.x) * x_sensitivity); - SetAxis(identifier, mouse_axis_y, static_cast(-mouse_move.y) * y_sensitivity); + SetAxis(identifier, mouse_axis_x, float(mouse_move[0]) * x_sensitivity); + SetAxis(identifier, mouse_axis_y, float(-mouse_move[1]) * y_sensitivity); last_motion_change = { - static_cast(-mouse_move.y) * x_sensitivity, - static_cast(-mouse_move.x) * y_sensitivity, - last_motion_change.z, + float(-mouse_move[1]) * x_sensitivity, + float(-mouse_move[0]) * y_sensitivity, + last_motion_change[2], }; } } @@ -220,18 +213,18 @@ void Mouse::ReleaseButton(MouseButton button) { SetAxis(identifier, mouse_axis_y, 0); } - last_motion_change.x = 0; - last_motion_change.y = 0; + last_motion_change[0] = 0; + last_motion_change[1] = 0; button_pressed = false; } void Mouse::MouseWheelChange(int x, int y) { - wheel_position.x += x; - wheel_position.y += y; - last_motion_change.z += static_cast(y); - SetAxis(identifier, wheel_axis_x, static_cast(wheel_position.x)); - SetAxis(identifier, wheel_axis_y, static_cast(wheel_position.y)); + wheel_position[0] += x; + wheel_position[1] += y; + last_motion_change[2] += static_cast(y); + SetAxis(identifier, wheel_axis_x, static_cast(wheel_position[0])); + SetAxis(identifier, wheel_axis_y, static_cast(wheel_position[1])); } void Mouse::ReleaseAllButtons() { diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h index 166168c824..25f75109b9 100644 --- a/src/input_common/drivers/mouse.h +++ b/src/input_common/drivers/mouse.h @@ -107,11 +107,11 @@ private: Common::Input::ButtonNames GetUIButtonName(const Common::ParamPackage& params) const; - Common::Vec2 mouse_origin; - Common::Vec2 last_mouse_position; - Common::Vec2 last_mouse_change; - Common::Vec3 last_motion_change; - Common::Vec2 wheel_position; + Common::Vec mouse_origin; + Common::Vec last_mouse_position; + Common::Vec last_mouse_change; + Common::Vec last_motion_change; + Common::Vec wheel_position; bool button_pressed = false; }; -- cgit v1.2.3