Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mouse_callback(GLFWwindow* window, double xpos, double ypos)
- {
- if (firstMouse)
- {
- lastX = xpos;
- lastY = ypos;
- firstMouse = false;
- }
- float xoffset = xpos - lastX;
- float yoffset = lastY - ypos;
- lastX = xpos;
- lastY = ypos;
- float sensitivity = 0.1f;
- xoffset *= sensitivity;
- yoffset *= sensitivity;
- yaw += xoffset;
- pitch += yoffset;
- if(pitch > 89.0f)
- pitch = 89.0f;
- if(pitch < -89.0f)
- pitch = -89.0f;
- glm::vec3 direction;
- direction.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch));
- direction.y = sin(glm::radians(pitch));
- direction.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch));
- cameraFront = glm::normalize(direction);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement