From 3b06e581c61b591c594ce821a209b4101bd456ff Mon Sep 17 00:00:00 2001 From: Amy Retzerau Date: Sat, 20 Dec 2025 21:58:48 +0100 Subject: [PATCH] fix: applied fixes for g++ --- fastmath.hpp | 5 +++-- polygon.hpp | 3 ++- renderer.hpp | 8 ++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fastmath.hpp b/fastmath.hpp index 40acdd4..cdda072 100644 --- a/fastmath.hpp +++ b/fastmath.hpp @@ -1,11 +1,12 @@ #ifndef FASTMATH_H #define FASTMATH_H -#include #include +#include #include #include #include +#include #define SHIFT_AMOUNT 16 #define HALF_SHIFT (SHIFT_AMOUNT / 2) @@ -26,7 +27,7 @@ struct decimal { decimal(double i) : i(TO_INT(i)) {} decimal(int32_t i) : i(i) {} - friend std::ostream &operator<<(std::ostream &os, const decimal &d) { + friend std::ostream& operator<<(std::ostream& os, const decimal &d) { return (os << TO_FLOAT(d.i)); } diff --git a/polygon.hpp b/polygon.hpp index f13876e..b56d984 100644 --- a/polygon.hpp +++ b/polygon.hpp @@ -2,6 +2,7 @@ #define POLYGON_H #include "fastmath.hpp" +#include struct polygon { vec3 points[3]; @@ -60,7 +61,7 @@ struct polygon { vec3 avgNormal() { vec3 result; - for (int i = 0; i++; i < 3) { + for (int i = 0; i < 3;i++) { result += normals[i]; } return result * decimal(0.3333); diff --git a/renderer.hpp b/renderer.hpp index 1a30e73..1ab9c0c 100644 --- a/renderer.hpp +++ b/renderer.hpp @@ -70,15 +70,15 @@ class Renderer { testP.calcDelta(); - int startX = std::max( + int startX = std::max( (testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT, 0); int endX = - std::min((testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT, + std::min((testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT,(uint32_t) target->width - 1); - int startY = std::max( + int startY = std::max( (testP.bounding[2] * invHeightScale).i >> SHIFT_AMOUNT, 0); int endY = - std::min((testP.bounding[3] * invHeightScale).i >> SHIFT_AMOUNT, + std::min((testP.bounding[3] * invHeightScale).i >> SHIFT_AMOUNT, target->height - 1); vec3 pos = vec3(testP.bounding[0], testP.bounding[2], 0.0);