uint ls__lineIndex(const in Ray ray, const in Mesh mesh, float tmin, float tmax, int face_in, int face_out, inout bool direction_swapped)
{
Linespace linespace = mesh.linespace;
PatchInfo entry_info;
PatchInfo exit_info;
// face_in > face_out is an unsupported configuration for reasons of generation performance and memory conservation.
// If that happens, flip tmin, tmax and the two faces accordingly and mark it as flipped to we can take the farthest intersection in the shaft instead of the nearest.
bool getLineIndex(const in Ray ray, const in Mesh mesh, inout uint line_id, inout bool direction_swapped)
{
float tmin, tmax;
int face_in, face_out;
direction_swapped = false;
//If the AABB is not intersected, cancel the traversal.
if (!intersectsRayBounds(ray, mesh.linespace.bounds, tmin, tmax, face_in, face_out))
return false;
PatchInfo entry_info;
PatchInfo exit_info;
// face_in > face_out is an unsupported configuration for reasons of generation performance and memory conservation.
// If that happens, flip tmin, tmax and the two faces accordingly and mark it as flipped to we can take the farthest intersection in the shaft instead of the nearest.