fix: applied fixes for g++

This commit is contained in:
2025-12-20 21:58:48 +01:00
parent a1d8d374c5
commit 3b06e581c6
3 changed files with 9 additions and 7 deletions

View File

@@ -1,11 +1,12 @@
#ifndef FASTMATH_H #ifndef FASTMATH_H
#define FASTMATH_H #define FASTMATH_H
#include <iostream>
#include <math.h> #include <math.h>
#include <iostream>
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <vector> #include <vector>
#include <iostream>
#define SHIFT_AMOUNT 16 #define SHIFT_AMOUNT 16
#define HALF_SHIFT (SHIFT_AMOUNT / 2) #define HALF_SHIFT (SHIFT_AMOUNT / 2)

View File

@@ -2,6 +2,7 @@
#define POLYGON_H #define POLYGON_H
#include "fastmath.hpp" #include "fastmath.hpp"
#include <iostream>
struct polygon { struct polygon {
vec3 points[3]; vec3 points[3];
@@ -60,7 +61,7 @@ struct polygon {
vec3 avgNormal() { vec3 avgNormal() {
vec3 result; vec3 result;
for (int i = 0; i++; i < 3) { for (int i = 0; i < 3;i++) {
result += normals[i]; result += normals[i];
} }
return result * decimal(0.3333); return result * decimal(0.3333);

View File

@@ -70,15 +70,15 @@ class Renderer {
testP.calcDelta(); testP.calcDelta();
int startX = std::max( int startX = std::max<int>(
(testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT, 0); (testP.bounding[0] * invWidthScale).i >> SHIFT_AMOUNT, 0);
int endX = int endX =
std::min((testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT, std::min<int>((testP.bounding[1] * invWidthScale).i >> SHIFT_AMOUNT,(uint32_t)
target->width - 1); target->width - 1);
int startY = std::max( int startY = std::max<int>(
(testP.bounding[2] * invHeightScale).i >> SHIFT_AMOUNT, 0); (testP.bounding[2] * invHeightScale).i >> SHIFT_AMOUNT, 0);
int endY = int endY =
std::min((testP.bounding[3] * invHeightScale).i >> SHIFT_AMOUNT, std::min<int>((testP.bounding[3] * invHeightScale).i >> SHIFT_AMOUNT,
target->height - 1); target->height - 1);
vec3 pos = vec3(testP.bounding[0], testP.bounding[2], 0.0); vec3 pos = vec3(testP.bounding[0], testP.bounding[2], 0.0);