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
#define FASTMATH_H
#include <iostream>
#include <math.h>
#include <iostream>
#include <stdint.h>
#include <stdlib.h>
#include <vector>
#include <iostream>
#define SHIFT_AMOUNT 16
#define HALF_SHIFT (SHIFT_AMOUNT / 2)

View File

@@ -2,6 +2,7 @@
#define POLYGON_H
#include "fastmath.hpp"
#include <iostream>
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);

View File

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