From 0c77bdb5a48343005dfdf1509d004b36022efb32 Mon Sep 17 00:00:00 2001 From: hachem Date: Mon, 18 Aug 2025 05:02:13 +0200 Subject: fix: improvements, bump to C++20 and fix bugs --- src/core/camera.cpp | 4 ++-- src/core/camera.h | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/core') diff --git a/src/core/camera.cpp b/src/core/camera.cpp index bba6ee2..9c2b061 100644 --- a/src/core/camera.cpp +++ b/src/core/camera.cpp @@ -163,7 +163,7 @@ namespace Donut glm::vec3 Camera::get_orbital_position() const { - float clamped_elevation = glm::clamp(m_elevation, 0.01f, float(M_PI) - 0.01f); + float clamped_elevation = glm::clamp(m_elevation, 0.01f, float(std::numbers::pi) - 0.01f); return glm::vec3 ( m_orbital_radius * sin(clamped_elevation) * cos(m_azimuth), @@ -191,7 +191,7 @@ namespace Donut m_azimuth += dx * m_orbital_speed; m_elevation -= dy * m_orbital_speed; - m_elevation = glm::clamp(m_elevation, 0.01f, float(M_PI) - 0.01f); + m_elevation = glm::clamp(m_elevation, 0.01f, float(std::numbers::pi) - 0.01f); } m_last_x_orbital = x; diff --git a/src/core/camera.h b/src/core/camera.h index 809be48..677cb71 100644 --- a/src/core/camera.h +++ b/src/core/camera.h @@ -3,10 +3,7 @@ #include #include -#define _USE_MATH_DEFINES -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include namespace Donut { @@ -121,7 +118,7 @@ namespace Donut double m_orbital_min_radius = 1e10; double m_orbital_max_radius = 1e12; float m_azimuth = 0.0f; - float m_elevation = static_cast(M_PI) / 2.0f; + float m_elevation = static_cast(std::numbers::pi) / 2.0f; float m_orbital_speed = 0.01f; double m_zoom_speed = 25e9f; bool m_dragging = false; -- cgit v1.3