First, we can exit early if there is no intersection.
Then, since a tangential hit and a normal radial intersection are only different when calculating tStepR, we only need a boolean for that case.
To avoid branch prediction slowdown, we can simply create an array {0, -1, 1}. Since true == 1 and false == 0, we can use some quick algebra to determine the right step value.
Also uses constexpr for EPSILON values, vec3, and spherical_voxel_grid.
First, we can exit early if there is no intersection.
Then, since a tangential hit and a normal radial intersection are only different when calculating tStepR, we only need a boolean for that case.
To avoid branch prediction slowdown, we can simply create an array {0, -1, 1}. Since
true == 1
andfalse == 0
, we can use some quick algebra to determine the right step value.Also uses constexpr for EPSILON values, vec3, and spherical_voxel_grid.