gonna get this clean one of these days.

This commit is contained in:
Yggdrasil75
2025-12-30 15:00:58 -05:00
parent 05f709c00b
commit 02115dcfc0
5 changed files with 133 additions and 846 deletions

View File

@@ -69,7 +69,7 @@ public:
if (rayDirection[i] >= 0) {
t0[i] = (0 - rayOrigin[i]) / rayDirection[i];
t1[i] = (width - rayOrigin[i]) / rayDirection[i];
} else {
} else {
t0[i] = (width - rayOrigin[i]) / rayDirection[i];
t1[i] = (0 - rayOrigin[i]) / rayDirection[i];
}
@@ -84,7 +84,7 @@ public:
if (tEnter > 0) {
voxel = Vec3f((rayOrigin + rayDirection * tEnter).floor());
}
}
}
// Initialize step and tMax based on ray direction
@@ -93,7 +93,7 @@ public:
step[i] = -1;
tMax[i] = ((float)voxel[i] - rayOrigin[i]) / rayDirection[i];
tDelta[i] = -1.0f / rayDirection[i];
} else {
} else {
step[i] = 1;
tMax[i] = ((float)(voxel[i] + 1) - rayOrigin[i]) / rayDirection[i];
tDelta[i] = 1.0f / rayDirection[i];
@@ -174,7 +174,7 @@ public:
Vec3f up;
float fov;
Camera() : position(0, 0, -10), forward(0, 0, 1), up(0, 1, 0), fov(45.0f) {}
Camera() : position(0, 0, -10), forward(0, 0, 1), up(0, 1, 0), fov(80.0f) {}
Mat4f getViewMatrix() const {
return lookAt(position, position + forward, up);