mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add debug GUI render mode (F8)
This commit is contained in:
parent
a74a4fcf53
commit
5af6b91b22
18 changed files with 93 additions and 29 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue