diff options
| author | hachem <im@hachem.wtf> | 2025-08-18 05:02:13 +0200 |
|---|---|---|
| committer | hachem <im@hachem.wtf> | 2025-08-18 05:02:13 +0200 |
| commit | 0c77bdb5a48343005dfdf1509d004b36022efb32 (patch) | |
| tree | 6bc9df4e16037eb557e5a3ce6d0dce4b3323cd48 /src/engine | |
| parent | d65233be9433a01c54e959aea72e87ff2e385937 (diff) | |
fix: improvements, bump to C++20 and fix bugs
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/engine.h | 6 | ||||
| -rw-r--r-- | src/engine/object.h | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/src/engine/engine.h b/src/engine/engine.h index 0d0fb1b..124fa39 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -1,6 +1,7 @@ #pragma once #include <vector> +#include <numbers> #include <iostream> #include <fstream> #include <sstream> @@ -21,11 +22,6 @@ #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> -#define _USE_MATH_DEFINES -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - namespace Donut { const double c = 299792458.0; diff --git a/src/engine/object.h b/src/engine/object.h index c45815b..19938d8 100644 --- a/src/engine/object.h +++ b/src/engine/object.h @@ -46,7 +46,7 @@ namespace Donut float a = glm::dot(ray.m_direction, ray.m_direction); float b = 2.0f * glm::dot(oc, ray.m_direction); float c = glm::dot(oc, oc) - m_radius * m_radius; - double discriminant = b*b - 4*a*c; + float discriminant = static_cast<float>(b*b - 4*a*c); if(discriminant < 0) return false; |
