75{
76 mposition.x = position[0];
77 mposition.y = position[1];
78 mposition.z = position[2];
79 mrotation.x = glm::radians(rotation[0]);
80 mrotation.y = glm::radians(rotation[1]);
81 mrotation.z = glm::radians(rotation[2]);
82 pitch = mrotation.x;
83 yaw = mrotation.y;
84 roll = mrotation.z;
85 view = glm::lookAt(mposition, mposition + cameraFront, cameraUp);
86 view = glm::rotate(view, glm::radians(mrotation.y), glm::vec3(1.0f, 0.0f, 0.0f));
87 view = glm::rotate(view, glm::radians(mrotation.x), glm::vec3(0.0f, 1.0f, 0.0f));
88
89 if (aspect > 200 || aspect < -200)
90 {
91 aspect = 16.0 / 9.0f;
92 }
93
94 if(perspective)
95 {
96 pers = glm::perspective(fov, (float)(fabs(aspect) < 100 ? fabs(aspect) : 1.0f), cNear, cFar);
97 }
98
99 else
100 {
101 pers = glm::ortho(-1.0f, 1.0f, -1.0f, 1.0f, cNear, cFar);
102 }
103
104 pv = pers * view;
105}