add debug GUI render mode (F8)

This commit is contained in:
MihailRis
2025-03-11 00:39:59 +03:00
parent a74a4fcf53
commit 5af6b91b22
18 changed files with 93 additions and 29 deletions
+7 -6
View File
@@ -33,14 +33,15 @@ glm::mat4 Camera::getProjection() const {
constexpr float epsilon = 1e-6f; // 0.000001
float aspect_ratio = this->aspect;
if (std::fabs(aspect_ratio) < epsilon) {
aspect_ratio = (float)Window::width / (float)Window::height;
aspect_ratio = Window::width / static_cast<float>(Window::height);
}
if (perspective)
if (perspective) {
return glm::perspective(fov * zoom, aspect_ratio, near, far);
else if (flipped)
return glm::ortho(0.0f, fov * aspect_ratio, fov, 0.0f);
else
return glm::ortho(0.0f, fov * aspect_ratio, 0.0f, fov);
} else if (flipped) {
return glm::ortho(-0.5f, fov * aspect_ratio-0.5f, fov, 0.0f);
} else {
return glm::ortho(-0.5f, fov * aspect_ratio-0.5f, 0.0f, fov);
}
}
glm::mat4 Camera::getView(bool pos) const {