fixed 1 direction

This commit is contained in:
yggdrasil75
2026-01-02 05:15:08 -05:00
parent a9caaeb40f
commit 7bc711a3ad
3 changed files with 75 additions and 42 deletions

View File

@@ -147,7 +147,7 @@ public:
tDelta.x = std::abs(1.0 / rayDir.x);
tDelta.y = std::abs(1.0 / rayDir.y);
tDelta.z = std::abs(1.0 / rayDir.z);
tMax = mix((rayOrigin - currentVoxel) / -rayDir, ((currentVoxel + 1) - rayOrigin) / rayDir, rayDir > 0);
tMax = mix(((rayOrigin - currentVoxel.toFloat()) / -rayDir).toFloat(), (((currentVoxel.toFloat() + 1) - rayOrigin) / rayDir).toFloat(), rayDir.mask([](float x, float value) { return x > 0; }, 0));
if (!inGrid(rayOrigin)) {
/*
The initialization phase begins by identifying the voxel in which the ray origin, →
@@ -179,9 +179,9 @@ public:
if (tEntry < 0.0) tEntry = 0.0;
if (tEntry > 0.0) {
rayOrigin = rayOrigin + rayDir + tEntry;
rayOrigin = rayOrigin + rayDir * tEntry;
currentVoxel = rayOrigin.floorToT();
tMax = mix(((currentVoxel + 1) - rayOrigin) / rayDir, (rayOrigin - currentVoxel) / -rayDir, rayDir > 0 );
tMax = mix(((currentVoxel.toFloat() + 1) - rayOrigin) / rayDir, (rayOrigin - currentVoxel) / -rayDir, rayDir.mask([](float x, float value) { return x > 0; }, 0) );
}
}
@@ -238,6 +238,9 @@ public:
}
}
}
if (aalpha > EPSILON) {
std::cout << "hit at: " << currentVoxel << " with value of " << aalpha << std::endl;
}
return hit;
}