Use modern scrolling for better UX

This commit is contained in:
PedroEdiaz
2024-11-04 20:56:50 -06:00
parent c37614ae52
commit 583c0cb92f

View File

@@ -107,13 +107,21 @@ void __mouse_callback_input(
void __scroll_callback_input(GLFWwindow *window, double xoffset, double yoffset) void __scroll_callback_input(GLFWwindow *window, double xoffset, double yoffset)
{ {
versor p = GLM_QUAT_IDENTITY_INIT; versor p = GLM_QUAT_IDENTITY_INIT;
versor r = GLM_QUAT_IDENTITY_INIT;
glm_quatv(p, yoffset * ANGLE, axis[selected_axis]); //glm_quatv(p, yoffset * ANGLE, axis[selected_axis]);
glm_quatv(p, yoffset * ANGLE * 2, (vec3){-1,0,0});
glm_quatv(r, xoffset * ANGLE * 2, (vec3){0,1,0});
glm_quat_mul(p, q, q); glm_quat_mul(p, q, q);
glm_quat_mul(r, q, q);
glm_quat_rotatev(p, axis[0], axis[0]); glm_quat_rotatev(p, axis[0], axis[0]);
glm_quat_rotatev(p, axis[1], axis[1]); glm_quat_rotatev(p, axis[1], axis[1]);
glm_quat_rotatev(p, axis[2], axis[2]); glm_quat_rotatev(p, axis[2], axis[2]);
glm_quat_rotatev(r, axis[0], axis[0]);
glm_quat_rotatev(r, axis[1], axis[1]);
glm_quat_rotatev(r, axis[2], axis[2]);
} }
quat_t poll_input(window_t window) quat_t poll_input(window_t window)