45 if (event.type == SDL_EVENT_MOUSE_MOTION)
47 SDL_MouseButtonFlags mouseState = SDL_GetMouseState(NULL, NULL);
48 if (mouseState & SDL_BUTTON_LMASK)
50 float yawDelta = -
event.motion.xrel * 1e-2f;
51 float pitchDelta = -
event.motion.yrel * 1e-2f;
52 quat yawRot = angleAxis(yawDelta, vec3(0, 1, 0));
53 quat pitchRot = angleAxis(pitchDelta, vec3(1, 0, 0));
54 rot = normalize(yawRot *
rot * pitchRot);
57 if (mouseState & SDL_BUTTON_RMASK)
59 vec3 right =
rot * vec3(1, 0, 0);
60 vec3 up =
rot * vec3(0, 1, 0);
66 if (event.type == SDL_EVENT_MOUSE_WHEEL)
74 vec3 dir =
rot * vec3(0, 0, 1);