Use modern scrolling for better UX
This commit is contained in:
12
src/input.c
12
src/input.c
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user