+ if (key == '2') {
+ curMode = debugProbAct;
+ needsRedisplay = true;
+ }
+ if (key == '3') {
+ curMode = debugProbExt;
+ needsRedisplay = true;
+ }
+}
+
+int prevMouseX, prevMouseY;
+bool firstMouse = true;
+void motion(int x, int y) {
+ if (firstMouse) {
+ prevMouseX = x;
+ prevMouseY = y;
+ firstMouse = false;
+ }
+ float dx = x - prevMouseX, dy = y - prevMouseY;
+ prevMouseX = x;
+ prevMouseY = y;
+ const vec3 origin(0, 18, 0);
+ const float sensitivity = 0.003f;
+ auto camMat = translate(mat4(1), origin + camPos);
+ auto rotation = rotate(rotate(mat4(1), -dx * sensitivity, {0, 1, 0}),
+ -dy * sensitivity, {1, 0, 0});
+ auto rotAroundOrig = camMat * rotation * translate(mat4(1), origin - camPos);
+ camPos = rotAroundOrig * glm::vec4(camPos, 0);
+ needsRedisplay = true;
+}
+
+void passiveMotion(int x, int y) {
+ prevMouseX = x;
+ prevMouseY = y;