Created
September 27, 2023 20:32
-
-
Save ThomasParistech/027fbb503a77dd58d45ed40c44a4c1f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) { | |
if (yoffset!=0) | |
camera.zoom(-yoffset); | |
} | |
void mouseButton(GLFWwindow* window, int button, int action, int mods) { | |
ImGuiIO& io = ImGui::GetIO(); | |
if (io.WantCaptureMouse) | |
return; | |
mouse_buttons[button] = action; | |
} | |
void mouseMotion(GLFWwindow* window, double xpos, double ypos) { | |
ImGuiIO& io = ImGui::GetIO(); | |
if (io.WantCaptureMouse) | |
return; | |
double dxn = (xpos - mouse_x) / window_w; | |
double dyn = (ypos - mouse_y) / window_h; | |
mouse_x = xpos; | |
mouse_y = ypos; | |
if (mouse_buttons[GLFW_MOUSE_BUTTON_LEFT] == GLFW_PRESS) | |
camera.rotate(dxn, dyn); | |
if (mouse_buttons[GLFW_MOUSE_BUTTON_RIGHT] == GLFW_PRESS) | |
camera.shift_center(dxn, dyn); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment