fix: PVS-Studio V550

Signed-off-by: Vyacheslav Ivanov <islavaivanov76@gmail.com>
This commit is contained in:
Vyacheslav Ivanov
2024-08-03 23:00:10 +03:00
committed by Pugemon
parent 3621e7ce1b
commit ab28b4df70
4 changed files with 19 additions and 14 deletions
+3 -1
View File
@@ -1,5 +1,6 @@
#include "Camera.hpp"
#include <cmath>
#include <glm/ext.hpp>
#include "Window.hpp"
@@ -29,8 +30,9 @@ void Camera::rotate(float x, float y, float z) {
}
glm::mat4 Camera::getProjection() {
constexpr float epsilon = 1e-6f; // 0.000001
float aspect = this->aspect;
if (aspect == 0.0f) {
if (std::fabs(aspect) < epsilon) {
aspect = (float)Window::width / (float)Window::height;
}
if (perspective)