From 34b7736e3a85ee1f41aaa8b0388975ae229b2148 Mon Sep 17 00:00:00 2001 From: Jan Herling Date: Wed, 16 Oct 2024 16:11:20 -0700 Subject: [PATCH] Minor fix in AKSceneTracker6DOF Summary: In the normals of a triangles are invalid, we need to ensure that we are testing the replacement triangle (from the back) as in the next loop (and not skipping it). Reviewed By: enpe Differential Revision: D64418240 fbshipit-source-id: b5143d617b8119bd2498892dfb01f3f6b0fd9fc9 --- impl/ocean/devices/arkit/AKSceneTracker6DOF.mm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/impl/ocean/devices/arkit/AKSceneTracker6DOF.mm b/impl/ocean/devices/arkit/AKSceneTracker6DOF.mm index 26c6c63f2..c3d0ca8c4 100644 --- a/impl/ocean/devices/arkit/AKSceneTracker6DOF.mm +++ b/impl/ocean/devices/arkit/AKSceneTracker6DOF.mm @@ -285,7 +285,7 @@ // ARKit sometimes provides invalid per-vertex normals, we remove these triangles - for (size_t n = 0; n < triangleIndices.size(); n += 3) + for (size_t n = 0; n < triangleIndices.size(); /*noop*/) { if (Numeric::isNan(perVertexNormals[triangleIndices[n + 0]].x()) || Numeric::isNan(perVertexNormals[triangleIndices[n + 1]].x()) @@ -297,6 +297,10 @@ triangleIndices.resize(triangleIndices.size() - 3); } + else + { + n += 3; + } } if (!triangleIndices.empty())