Fix a froxelization bug

we would be short by one froxel on the left, usually this wasn't
a problem due to the light falloff.
This commit is contained in:
Pixelflinger
2020-04-15 22:00:10 -07:00
committed by Mathias Agopian
parent 8ae8dd59b1
commit afade93bad
+3 -1
View File
@@ -856,7 +856,9 @@ void Froxelizer::froxelizePointAndSpotLight(
// find the begin index (left side)
for (bx = x0; bx <= xcenter; ++bx) {
if (spherePlaneDistanceSquared(cy, planesX[bx].x, planesX[bx].z) > 0) {
// intersection
// intersection, if we intersect with a plane at index bx, we
// actually intrude in the froxel to its left, i.e. with index bx - 1
bx -= bx > 0;
break;
}
}