Working camera using mouse

This commit is contained in:
Mateusz Drewniak 2022-01-03 17:33:53 +01:00
parent c8afd00b4b
commit f648151410
2 changed files with 4 additions and 2 deletions

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ Debug
Release
*.dll
target
.Spotlight-V100
.vs

View File

@ -64,8 +64,8 @@ void mouse(int x, int y)
glm::mat4 createCameraMatrix()
{
glm::quat xMouseRotation = glm::angleAxis(mousePositionDifference[0], glm::vec3(1, 0, 0));
glm::quat yMouseRotation = glm::angleAxis(mousePositionDifference[1], glm::vec3(0, 1, 0));
glm::quat xMouseRotation = glm::angleAxis(mousePositionDifference[0] / 120, glm::vec3(0, 1, 0));
glm::quat yMouseRotation = glm::angleAxis(mousePositionDifference[1] / 120, glm::vec3(1, 0, 0));
glm::quat mouseRotation = xMouseRotation * yMouseRotation;
mousePositionDifference = {0, 0};